"use strict";
function _toConsumableArray(e) {
    if (Array.isArray(e)) {
        for (var n = 0,
        t = Array(e.length); n < e.length; n++) t[n] = e[n];
        return t
    }
    return Array.from(e)
}
var _slicedToArray = function() {
    function e(e, n) {
        var t = [],
        o = !0,
        l = !1,
        r = void 0;
        try {
            for (var i, a = e[Symbol.iterator](); ! (o = (i = a.next()).done) && (t.push(i.value), !n || t.length !== n); o = !0);
        } catch(e) {
            l = !0,
            r = e
        } finally {
            try { ! o && a.
                return && a.
                return ()
            } finally {
                if (l) throw r
            }
        }
        return t
    }
    return function(n, t) {
        if (Array.isArray(n)) return n;
        if (Symbol.iterator in Object(n)) return e(n, t);
        throw new TypeError("Invalid attempt to destructure non-iterable instance")
    }
} (),
_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ?
function(e) {
    return typeof e
}: function(e) {
    return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol": typeof e
}; !
function(e) {
    var n = function() {
        var e = Date.now(),
        n = function() {
            return Math.random().toString(36)[4] || "0"
        };
        return function() {
            var t = [].concat(_toConsumableArray(Array(8))).map(n).join("").toUpperCase();
            return "AUTO_GENERATED_INDEX_" + ++e + "_" + t
        }
    } (),
    t = function(e, n) {
        var t = [];
        return n.$on("$destory",
        function() {
            t.forEach(function(n) {
                return e.cancel(n)
            })
        }),
        function(n) {
            for (var o = arguments.length,
            l = Array(o > 1 ? o - 1 : 0), r = 1; r < o; r++) l[r - 1] = arguments[r];
            var i = e.call.apply(e, [this,
            function() {
                t.splice(a, 1),
                n.apply(this, arguments)
            }].concat(l)),
            a = t.push(i) - 1
        }
    },
    o = function(e, n) {
        return t.apply(this, arguments)
    },
    l = function(e) {
        var n = [];
        return e.$on("$destory",
        function() {
            n.forEach(function(e) {
                return e()
            })
        }),
        function(e) {
            n.push()
        }
    };
    e.component("debugger", {
        template: '\n      <div class="debugger-container" ng-if="$ctrl.debuggerEnabled">\n        <span class="debugger-title" style="font-weight: bold" ng-if="$ctrl.text" ng-bind="$ctrl.text"></span>\n        <span class="debugger-content" ng-bind="$ctrl.result"></span>\n      </div>\n    ',
        bindings: {
            text: "@",
            value: "<?"
        },
        controller: ["$scope",
        function(e) {
            var n = this;
            n.debuggerEnabled = ["localhost", "127.0.0.1"].indexOf(location.hostname) !== -1 || !!localStorage.debuggerEnabled;
            var t = function() {
                if ("uneval" in window) return window.uneval;
                var e = function e(n, t) {
                    try {
                        if (void 0 === n) return "(void 0)";
                        if (null === n) return "null";
                        if (null == n) throw "not support undetectable";
                        if (0 === n && 1 / n == -(1 / 0)) return "-0";
                        if ("number" == typeof n) return Number.prototype.toString.call(n);
                        if ("boolean" == typeof n) return Boolean.prototype.toString.call(n);
                        if ("string" == typeof n) return JSON.stringify(n);
                        if ("symbol" === (void 0 === n ? "undefined": _typeof(n))) throw "symbol not supported";
                        if (! (n instanceof Object)) throw "not supported type";
                        if (n instanceof Number) return "(new Number(" + e(Number.prototype.valueOf.call(n)) + "))";
                        if (n instanceof String) return "(new String(" + e(String.prototype.valueOf.call(n)) + "))";
                        if (n instanceof Boolean) return "(new Boolean(" + e(Boolean.prototype.valueOf.call(n)) + "))";
                        if (n instanceof RegExp) return n.toString();
                        if (n instanceof Date) return "(new Date(" + e(Date.prototype.valueOf(n)) + "))";
                        if (n instanceof Error) return "(new Error(" + e(n.message) + "))";
                        if (n instanceof Symbol) throw "symbol not supported";
                        if (n instanceof Function) {
                            var o = "" + n;
                            return !! o.replace(/\s/g, "").match(/function[^(]*\(\)\{\[nativecode\]\}/) ? '(function () { "native ${obj.name} function" })': "(" + o + ")"
                        }
                        if (t.indexOf(n) !== -1) return n instanceof Array ? "[]": "({})";
                        var l = t.concat([n]);
                        if (n instanceof Array) {
                            if (0 === n.length) return "[]";
                            var r = !(n.length - 1 in n);
                            return "[" + n.map(function(n) {
                                return e(n, l)
                            }).join(", ") + (r ? ",": "") + "]"
                        }
                        if (n instanceof Object) {
                            return "({" + Object.keys(n).filter(function(e) {
                                return "$" !== e[0]
                            }).map(function(t) {
                                return JSON.stringify(t) + ": " + e(n[t], l)
                            }).join(", ") + "})"
                        }
                    } catch(e) {
                        return '(void ("uneval not supported: ' + JSON.stringify(e.message).slice(1) + "))"
                    }
                };
                return function(n) {
                    return e(n, [])
                }
            } ();
            e.$watch("$ctrl.value",
            function() {
                n.result = t(n.value)
            },
            !0)
        }]
    }),
    e.component("icon", {
        template: "\n      <i class=\"\n        icon icon16 icon-{{ $ctrl.name || 'custom' }}\n        fa icon-fa fa-{{ $ctrl.type }}\n        {{ $ctrl.disabled ? 'icon-disabled' : '' }}\n      \" ng-style=\"{\n        color: $ctrl.disabled ? '#cccccc' : ($ctrl.color || '#777')\n      }\"></i>\n    ",
        bindings: {
            name: "@?",
            type: "@",
            color: "@?",
            disabled: "@?"
        },
        controller: [function() {}]
    }),
    e.component("iconGroup", {
        template: '<div class="icon-group-container" ng-transclude></div>',
        bindings: {},
        transclude: !0,
        controller: [function() {}]
    }),
    function() {
        var n = {
            danger: "#f05050",
            active: "#29b6f6",
            gitlab: "#ff9800",
            ok: "#4bd396",
            cancel: "#f05050",
            close: "#777",
            placeholder: "#ddd",
            text: "#777",
            info: "#aaa",
            edit: "#188ae2",
            button: "#fff"
        },
        t = [{
            name: "delete",
            type: "trash-o",
            color: n.danger
        },
        {
            name: "details",
            type: "ellipsis-v"
        },
        {
            name: "transfer",
            type: "external-link",
            color: n.active
        },
        {
            name: "stop",
            type: "stop",
            color: n.danger
        },
        {
            name: "info",
            type: "info-circle"
        },
        {
            name: "edit",
            type: "pencil",
            color: n.edit
        },
        {
            name: "gitlab",
            type: "gitlab",
            color: n.gitlab
        },
        {
            name: "save",
            type: "floppy-o",
            color: n.ok
        },
        {
            name: "cancel",
            type: "times",
            color: n.cancel
        },
        {
            name: "close",
            type: "times",
            color: n.close
        },
        {
            name: "search",
            type: "search",
            color: n.placeholder
        },
        {
            name: "drop-down",
            type: "caret-down",
            color: n.text
        },
        {
            name: "clipboard",
            type: "clipboard"
        },
        {
            name: "download",
            type: "download"
        },
        {
            name: "file",
            type: "file-text-o",
            color: n.active
        },
        {
            name: "document",
            type: "file-o"
        },
        {
            name: "user",
            type: "user-o"
        },
        {
            name: "nav-switch",
            type: "bars"
        },
        {
            name: "right-arrow",
            type: "angle-right"
        },
        {
            name: "down-arrow",
            type: "angle-down"
        },
        {
            name: "list",
            type: "list-alt",
            color: n.active
        },
        {
            name: "plus",
            type: "plus"
        },
        {
            name: "setting",
            type: "cog"
        }],
        o = {};
        t.forEach(function(n) {
            var t = n.name,
            l = n.type,
            r = n.color;
            o[t] = n,
            void 0 === r && (r = "inherit");
            var i = ("icon-" + t).replace(/./g,
            function(e) {
                return e !== e.toLowerCase() ? "-" + e.toLowerCase() : e
            }).replace(/[-_\s]+(\w)/g,
            function(e, n) {
                return n.toUpperCase()
            }),
            a = i.replace(/./g,
            function(e) {
                return e !== e.toLowerCase() ? "-" + e.toLowerCase() : e
            });
            e.component(i, {
                template: '\n          <icon name="' + a + '" type="' + l + '" color="' + r + "\" disabled=\"{{ $ctrl.disabled ? 'disabled' : '' }}\"></icon>\n        ",
                bindings: {
                    disabled: "@?"
                },
                controller: [function() {}]
            })
        }),
        e.component("iconByName", {
            template: '\n        <icon name="icon-{{ $ctrl.name }}" type="{{ $ctrl.type }}" color="{{ $ctrl.color }}" disabled="{{ $ctrl.disabled ? \'disabled\' : \'\' }}"></icon>\n      ',
            bindings: {
                disabled: "@?",
                name: "@"
            },
            controller: ["$scope",
            function(e) {
                var n = this;
                e.$watch("$ctrl.name",
                function() {
                    if (n.name in o) {
                        var e = o[n.name];
                        n.type = e.type,
                        n.color = e.color
                    }
                })
            }]
        })
    } (),
    e.component("titleLine", {
        template: '\n      <div class="title-line">\n        <div class="title-container"><h2 class="content-title" ng-bind="$ctrl.text"></h2></div>\n        <div class="title-line-remaind" ng-transclude></div>\n      </div>\n    ',
        transclude: !0,
        bindings: {
            text: "@",
            param: "=?"
        },
        controller: [function() {}]
    }),
    e.component("formContainer", {
        template: '\n      <style>\n        #{{ $ctrl.uniqueId }} .form-config-item-title  {\n          width: {{ $ctrl.leftWidth }}px;\n        }\n        #{{ $ctrl.uniqueId }} .form-config-item-wrapper {\n          max-width: {{ 2 * ($ctrl.leftWidth + $ctrl.requireWidth) + $ctrl.inputMaxWidth }}px;\n        }\n        #{{ $ctrl.uniqueId }} .form-config-item-wrapper .form-config-item-wrapper {\n          padding-right: 0;\n        }\n        #{{ $ctrl.uniqueId }} .form-config-item {\n          padding-left: {{ $ctrl.leftWidth + $ctrl.requireWidth }}px;\n          max-width: {{ $ctrl.leftWidth + $ctrl.requireWidth + $ctrl.inputMaxWidth }}px;\n        }\n      </style>\n      <div id="{{ $ctrl.uniqueId }}" class="form-container-inner new-layout" ng-cloak ng-transclude>\n      </div>\n    ',
        bindings: {
            leftColumnWidth: "@"
        },
        transclude: !0,
        controller: ["$scope",
        function(e) {
            var t = this;
            t.uniqueId = n(),
            t.defaultLeftWidth = 120,
            t.inputMaxWidth = 880,
            t.requireWidth = 28,
            e.$watch("$ctrl.leftColumnWidth",
            function() {
                var e = parseInt(t.leftColumnWidth, 10);
                t.leftWidth = Number.isFinite(e) && e >= 0 ? e: t.defaultLeftWidth
            })
        }]
    }),
    e.component("subFormContainer", {
        template: '\n      <form-container left-column-width="{{ $ctrl.leftColumnWidth }}">\n        <div class="sub-form-container" ng-transclude></div>\n      </form-container>\n    ',
        bindings: {
            leftColumnWidth: "@"
        },
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formConfigGroup", {
        template: '\n      <div class="form-config-group-inner" ng-transclude>\n      </div>\n    ',
        bindings: {},
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formButtonGroup", {
        template: '\n      <div class="form-config-group-inner form-config-button-group-inner" ng-transclude>\n      </div>\n    ',
        bindings: {},
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formButtonCollection", {
        template: '\n      <div class="form-button-collection-container" ng-transclude>\n      </div>\n    ',
        bindings: {},
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formConfigItem", {
        template: '\n      <div class="form-config-item-wrapper">\n        <div class="form-config-item" ng-class="{\'form-config-item-required\': $ctrl.required}">\n          <div class="form-config-item-title" ng-bind="$ctrl.configTitle"></div>\n          <div class="form-config-item-content" ng-transclude ng-cloak></div>\n        </div>\n      </div>\n    ',
        bindings: {
            required: "@",
            configTitle: "@"
        },
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formErrorMessage", {
        template: '\n      <input type="hidden" ng-if="$ctrl.condition !== undefined" required ng-model="$ctrl.valid" />\n      <div class="form-input-error-message" ng-show="\n        $ctrl.form && $ctrl.target && (\n          $ctrl.form.$submitted &&\n          $ctrl.form[$ctrl.target] &&\n          $ctrl.form[$ctrl.target].$invalid &&\n          $ctrl.form[$ctrl.target].$error &&\n          (!$ctrl.type || $ctrl.form[$ctrl.target].$error[$ctrl.type])\n        ) ||\n        $ctrl.condition && $ctrl.form.$submitted\n      " ng-transclude></div>\n    ',
        bindings: {
            form: "<?",
            target: "@?",
            type: "@?",
            condition: "<?"
        },
        transclude: !0,
        controller: ["$scope",
        function(e) {
            var n = this;
            e.$watch("$ctrl.condition",
            function() {
                n.valid = n.condition === !0 ? "": "valid"
            })
        }]
    }),
    e.component("formSubmitButton", {
        template: '\n      <button type="submit" ng-transclude  ng-disabled="$ctrl.ngDisabled" ng-click=" $ctrl.validThenTriggerSubmit($event) "></button>\n    ',
        bindings: {
            form: "<",
            onSubmit: "&",
            ngDisabled: "<"
        },
        transclude: !0,
        controller: [function() {
            var e = this;
            e.validThenTriggerSubmit = function(n) {
                e.form.$setSubmitted(),
                angular.forEach(e.form,
                function(n) {
                    n && n.$$parentForm === e.form && n.$setSubmitted && n.$setSubmitted()
                }),
                e.form.$invalid || (e.onSubmit(), n.preventDefault(), n.stopPropagation())
            }
        }]
    }),
    e.component("formHelp", {
        template: '<span class="form-help-text" ng-transclude></span>',
        bindings: {},
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formHelpLine", {
        template: '<div class="form-help-text form-help-text-line" ng-transclude></div>',
        bindings: {},
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formInputContainer", {
        template: '\n      <div class="form-input-container">\n        <form-help class="form-input-help-text-top" ng-if="$ctrl.helpText && ($ctrl.helpTextPosition || \'top\') === \'top\'">{{ $ctrl.helpText }}</form-help>\n        <div class="form-input-container-inner" ng-if="!($ctrl.helpText && $ctrl.helpTextPosition === \'right\')" ng-transclude></div>\n        <div class="form-input-container-inner form-multiple-inline-container" ng-if="($ctrl.helpText && $ctrl.helpTextPosition === \'right\')">\n          <div class="form-input-container-inner-options form-multiple-inline-item-replacement" ng-transclude></div>\n          <form-help class="form-input-help-text-right form-multiple-inline-item-replacement" ng-if="$ctrl.helpText && $ctrl.helpTextPosition === \'right\'">{{ $ctrl.helpText }}</form-help>\n        </div>\n        <form-help class="form-input-help-text-bottom" ng-if="$ctrl.helpText && $ctrl.helpTextPosition === \'bottom\'">{{ $ctrl.helpText }}</form-help>\n      </div>\n    ',
        bindings: {
            helpTextPosition: "@",
            helpText: "@"
        },
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formLeftRight", {
        template: '\n      <div class="form-left-right-container">\n        <div class="form-left-right-wrapper">\n          <div class="form-left-right-left" ng-style="{ width: $ctrl.leftWidth }" ng-transclude="left"></div>\n          <div class="form-left-right-space"></div>\n          <div class="form-left-right-right" ng-style="{ width: $ctrl.rightWidth }" ng-transclude="right"></div>\n        </div>\n      </div>\n    ',
        bindings: {
            leftWidth: "@",
            rightWidth: "@"
        },
        transclude: {
            left: "left",
            right: "right"
        },
        controller: [function() {}]
    }),
    e.component("formMultipleInline", {
        template: "\n      <div\n        class=\"form-multiple-inline-container\"\n        ng-class=\"{\n          'form-multiple-inline-align-left': $ctrl.align === 'left',\n          'from-multiple-inline-for-search': $ctrl.contentType === 'search',\n         }\"\n        ng-transclude\n      ></div>\n    ",
        bindings: {
            align: "@",
            contentType: "@"
        },
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formMultipleInlineItem", {
        template: '\n      <div class="form-multiple-inline-item-inner"\n        ng-transclude></div>\n    ',
        bindings: {
            width: "@"
        },
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formMultipleOneLine", {
        template: '\n      <div class="form-multiple-one-line-container">\n        <div class="form-multiple-one-line-wrapper">\n        </div>\n      </div>\n    ',
        bindings: {
            align: "@"
        },
        transclude: !0,
        controller: [function() {}]
    }),
    e.component("formWithButton", {
        template: '\n      <div class="form-with-button-container">\n        <form-left-right right-width="{{ $ctrl.width || \'120px\' }}">\n          <left><div class="form-with-button-content" ng-transclude="content"></div></left>\n          <right><div class="form-with-button-button" ng-transclude="button"></div></right>\n        </form-left-right>\n      </div>\n    ',
        bindings: {
            width: "@"
        },
        transclude: {
            content: "contentArea",
            button: "buttonArea"
        },
        controller: [function() {}]
    }),
    e.component("formInputRadioGroup", {
        template: '\n      <div class="form-input-radio-container" ng-class="{ \'form-input-radio-as-card\': $ctrl.cardTemplate }">\n        <form-multiple-inline align="{{ $ctrl.width ? \'left\' : \'justify\' }}">\n          <form-multiple-inline-item class="form-input-radio-inner" width="{{ $ctrl.width }}" ng-repeat="option in $ctrl.options">\n            <label ng-if="option.value">\n              <span class="form-input-radio-option-container" ng-class="{ \'form-input-radio-option-checked\': $ctrl.value === option.value }">\n                <span class="form-input-radio-wrapper">\n                  <input class="form-input-radio" type="radio" name="{{ $ctrl.name }}" value="{{ option.value }}" ng-model="$ctrl.value" ng-required="!$ctrl.value && $ctrl.required" />\n                  <span class="form-input-radio-icon"></span>\n                </span>\n                <span class="form-input-radio-text" ng-bind="option.text" ng-if="!$ctrl.cardTemplate"></span>\n                <div class="form-input-radio-card" ng-include="$ctrl.cardTemplate" ng-if="$ctrl.cardTemplate" ng-repeat="item in [option]"></div>\n              </span>\n            </label>\n            <label ng-if="!option.value && !$ctrl.cardTemplate">\n              <span class="form-input-radio-option-container" ng-class="{ \'form-input-radio-option-checked\': $ctrl.value === $ctrl.customFakeValue }">\n                <span class="form-input-radio-wrapper">\n                  <input class="form-input-radio" type="radio" name="{{ $ctrl.name }}" value="{{ $ctrl.customFakeValue }}" ng-model="$ctrl.value" ng-required="!$ctrl.value && $ctrl.required" />\n                  <span class="form-input-radio-icon"></span>\n                </span>\n              <input class="form-input-radio-input" type="text" placeholder="{{ option.text }}" ng-model="$ctrl.customValue" ng-change="$ctrl.updateCustom" />\n              </span>\n            </label>\n          </form-multiple-inline-item>\n        </form-multiple-inline>\n      </div>\n    ',
        bindings: {
            name: "@",
            options: "<",
            ngModel: "=",
            onChange: "&",
            required: "@",
            fallbackValue: "<?",
            width: "@",
            cardTemplate: "@"
        },
        controller: ["$scope", "$timeout",
        function(e, o) {
            var l = this,
            r = t(o, e);
            l.customValue = "",
            l.customFakeValue = n(),
            l.value = "",
            l.name || (l.name = n());
            var i = function(e) {
                return angular.isArray(l.options) ? l.options.filter(function(n) {
                    return n.value === e
                }).length ? "valid": l.options.some(function(e) {
                    return ! e.value
                }) ? l.customFakeValue === e ? "fake": "custom": "" === e ? "empty": "invalid": null
            },
            a = function() {
                var e = i(l.ngModel);
                "invalid" !== e && "empty" !== e || u(),
                "custom" !== e && "fake" !== e && l.ngModel !== l.customValue || (l.customValue = l.ngModel, l.value = l.customFakeValue),
                "valid" === e && (l.value = l.ngModel)
            },
            c = function() {
                l.ngModel = l.value = null,
                l.customValue = "",
                p()
            },
            s = function(e) {
                if (e === !0 && (e = (l.options[0] || {}).value), e || (e = null), angular.isArray(e)) return e.some(u);
                var n = null === e ? "null": i(e);
                return null !== n ? "invalid" !== n && "fake" !== n && ("custom" === n && (l.ngModel = l.customValue = e, l.value = l.customFakeValue, p()), "valid" === n && (l.ngModel = l.value = e, p()), "null" !== n && "empty" !== n || c(), !0) : void 0
            },
            u = function() {
                s(l.fallbackValue) || c()
            },
            d = function() {
                var e = i(l.value);
                null !== e && ("invalid" !== e && "custom" !== e && "empty" !== e || u(), "fake" === e && (l.ngModel = l.customValue, p()), "valid" === e && (l.ngModel = l.value, p()))
            },
            m = function() {
                var e = i(l.value);
                null !== e && ("invalid" === e && u(), "custom" === e && (l.customValue = l.value, l.value = l.customFakeValue), "fake" === e && "valid" === i(l.ngModel) && (l.value = l.ngModel, l.customValue = ""), "empty" === e && u(), d())
            };
            l.updateCustom = function(e, n) {
                l.value = l.customFakeValue,
                d()
            };
            var p = function() {
                r(function() {
                    return l.onChange()
                },
                0)
            };
            a(),
            e.$watch("$ctrl.ngModel", a),
            e.$watch("$ctrl.value", d),
            e.$watch("$ctrl.options", m)
        }]
    }),
    e.component("formInputRadioCardSample", {
        template: '\n      <span class="form-input-radio-card-sample" style="display: block;">\n        <span style="display: block; font-weight: bold;">一些文字</span>\n        <span style="display: block;" ng-bind=" $ctrl.option.text "></span>\n      </span>\n    ',
        bindings: {
            option: "="
        },
        controller: [function() {}]
    }),
    e.component("formInputCheckbox", {
        template: '\n      <div class="form-input-checkbox-container" ng-class="{\n        \'form-input-checkbox-as-switch-container\': $ctrl.appearance === \'switch\',\n        \'form-input-checkbox-as-button-container\': $ctrl.appearance === \'button\',\n        \'form-input-checkbox-hidden-container\': $ctrl.appearance === \'none\',\n      }">\n        <input\n          name="{{ $ctrl.valid ? $ctrl.randomName : $ctrl.name }}"\n          type="hidden"\n          ng-model="$ctrl.empty"\n          ng-required="!$ctrl.valid"\n          ng-disabled="$ctrl.valid"\n        />\n        <label>\n          <span class="form-input-checkbox-option-container" ng-class="{ \'form-input-checkbox-option-checked\': $ctrl.value }">\n            <span class="form-input-checkbox-wrapper">\n              <input class="form-input-checkbox"\n                name="{{ $ctrl.valid ? $ctrl.name : $ctrl.randomName }}"\n                type="checkbox"\n                ng-model="$ctrl.value"\n              />\n              <span class="form-input-checkbox-icon"></span>\n            </span>\n            <span class="form-input-radio-content">\n              <span class="form-input-radio-text" ng-if="$ctrl.text != null" ng-bind="$ctrl.text"></span>\n              <span class="form-input-radio-complex" ng-if="$ctrl.text == null" ng-transclude></span>\n          </span>\n          </span>\n        </label>\n      </div>\n    ',
        bindings: {
            name: "@",
            valueTrue: "<?value",
            valueFalse: "<?",
            ngModel: "=",
            required: "@",
            requiredFalse: "@",
            onChange: "&",
            text: "@?",
            appearance: "@"
        },
        transclude: !0,
        controller: ["$scope", "$timeout",
        function(e, o) {
            var l = this,
            r = t(o, e);
            l.empty = "",
            l.randomName = n(),
            l.valid = !1,
            l.name || (l.name = n()),
            void 0 === l.valueTrue && (l.valueTrue = "on"),
            void 0 === l.valueFalse && (l.valueFalse = "");
            var i = function() {
                l.ngModel === l.valueTrue ? l.value = !0 : l.ngModel === l.valueFalse ? l.value = !1 : l.ngModel = l.value ? l.valueTrue: l.valueFalse
            },
            a = function() {
                "boolean" != typeof l.value && (l.value = 1 == l.value),
                l.ngModel !== l.valueTrue && l.value && (l.ngModel = l.valueTrue, r(function() {
                    return l.onChange()
                },
                0)),
                l.ngModel === l.valueFalse || l.value || (l.ngModel = l.valueFalse, r(function() {
                    return l.onChange()
                },
                0))
            },
            c = function() {
                l.valid = !(l.value ? l.requiredFalse: l.required)
            };
            e.$watch("$ctrl.ngModel", i),
            e.$watch("$ctrl.value", a),
            e.$watch("$ctrl.valueTrue", a),
            e.$watch("$ctrl.valueFalse", a),
            e.$watch("$ctrl.value", c)
        }]
    }),
    e.component("formSearchBox", {
        template: '\n      <div class="form-search-box-container"><label>\n        <input class="form-search-box-input" type="search" ng-model="$ctrl.ngModel" placeholder="{{ $ctrl.placeholder || \'\' }}" ng-model-option="{ debounce: $ctrl.debounce || 0 }" ng-change="$ctrl.change()" />\n        <icon-search class="form-search-box-icon"></icon-search>\n      </label></div>\n    ',
        bindings: {
            ngModel: "=",
            placeholder: "@",
            debounce: "<?",
            onChange: "&"
        },
        controller: ["$scope", "$timeout",
        function(e, n) {
            var o = this,
            l = t(n, e);
            o.change = function() {
                l(function() {
                    o.onChange()
                })
            }
        }]
    }),
    e.component("formSearchBoxWithCount", {
        template: '\n      <form-multiple-inline>\n        <form-multiple-inline-item class="form-search-box-text-wrapper">\n          <span class="form-search-box-text" ng-if="$ctrl.total || $ctrl.total === 0">\n            <span class="form-search-box-text-prefix" ng-bind="$ctrl.textPrefix"></span>\n            <span class="form-search-box-text-match" ng-bind="$ctrl.match" ng-if="$ctrl.ngModel"></span>\n            <span class="form-search-box-text-line" ng-if="$ctrl.ngModel">/</span>\n            <span class="form-search-box-text-total" ng-bind="$ctrl.total"></span>\n            <span class="form-search-box-text-prefix" ng-bind="$ctrl.textSuffix"></span>\n          </span>\n        </form-multiple-inline-item>\n        <form-multiple-inline-item class="form-search-box-wrapper">\n          <form-search-box ng-model="$ctrl.ngModel" placeholder="{{ $ctrl.placeholder }}" debounce="$ctrl.debounce" on-change="$ctrl.change()"></form-search-box>\n        </form-multiple-inline-item>\n      </form-multiple-inline>\n    ',
        bindings: {
            ngModel: "=",
            placeholder: "@",
            debounce: "<?",
            textPrefix: "@",
            textSuffix: "@",
            total: "@",
            match: "@",
            onChange: "&"
        },
        controller: ["$scope", "$timeout",
        function(e, n) {
            var o = this,
            l = t(n, e);
            o.change = function() {
                l(function() {
                    o.onChange()
                })
            }
        }]
    }),
    e.component("formArrayContainer", {
        template: '\n      <div class="form-array-container" ng-class="{ \'form-array-container-complex\': $ctrl.type === \'complex\' }">\n        <div class="form-array-item" ng-repeat=\'item in $ctrl.ngModel track by $index\'>\n          <div class="form-array-item-content" ng-if="$ctrl.type === \'simple\'">\n            <div class="form-array-item-wrapper" ng-include="$ctrl.template" ng-if="$ctrl.template"></div>\n          </div>\n          <div class="form-array-item-content" ng-if="$ctrl.type === \'complex\'">\n            <sub-form-container left-column-width="{{ $ctrl.leftColumnWidth }}">\n              <form-config-group>\n                <div class="form-array-item-wrapper" ng-if="$ctrl.template" ng-include="$ctrl.template"></div>\n              </form-config-group>\n            </sub-form-container>\n          </div>\n          <div class="form-array-item-delete" ng-click="$ctrl.deleteItem($index)" ng-if="$ctrl.minLength - 0 === $ctrl.minLength && $ctrl.ngModel.length > $ctrl.minLength">\n            <icon-delete class="form-array-item-delete-icon" ng-if="$ctrl.type === \'simple\'"></icon-delete>\n            <icon-close class="form-array-item-delete-icon" ng-if="$ctrl.type === \'complex\'"></icon-close>\n          </div>\n          <div class="form-array-item-delete form-array-item-delete-disabled" ng-if="!($ctrl.minLength - 0 === $ctrl.minLength && $ctrl.ngModel.length > $ctrl.minLength) && $ctrl.type === \'simple\'">\n            <icon-delete class="form-array-item-delete-icon" ng-if="$ctrl.type === \'simple\'" disabled="disabled"></icon-delete>\n          </div>\n        </div>\n        <div class="form-array-item-add" ng-click="$ctrl.addItem()" ng-if="$ctrl.maxLength - 0 === $ctrl.maxLength && $ctrl.ngModel.length < $ctrl.maxLength"></div>\n      </div>\n    ',
        bindings: {
            ngModel: "=",
            template: "@",
            itemDraft: "<",
            onChange: "&",
            onAdd: "&",
            onDelete: "&",
            maxLength: "<",
            minLength: "<",
            type: "@",
            leftColumnWidth: "@",
            param: "<?"
        },
        transclude: !0,
        controller: ["$scope",
        function(e) {
            var n = this;
            n.addItem = function() {
                angular.isArray(n.ngModel) || (n.ngModel = []);
                var e = angular.copy(n.itemDraft);
                angular.isFunction(e) && (e = e(n.ngModel));
                var t = n.ngModel.push(e) - 1;
                n.onAdd({
                    item: e,
                    index: t
                })
            },
            n.deleteItem = function(e) {
                var t = n.ngModel.splice(e, 1)[0];
                n.onDelete({
                    item: t,
                    index: e
                })
            };
            var t = function() {
                angular.isArray(n.ngModel) || (n.ngModel = []);
                var e = n.maxLength,
                t = n.minLength;
                if (e = Math.max(e - 0 === e ? e: 1 / 0, 0), t = Math.max(t - 0 === t ? t: 0, 0), !(e < t)) {
                    for (; n.ngModel.length < t;) n.addItem();
                    for (; n.ngModel.length > e;) n.deleteItem(n.ngModel.length - 1)
                }
            },
            o = function() {
                n.onChange()
            };
            t(),
            e.$watch("$ctrl.ngModel", t, !0),
            e.$watch("$ctrl.ngModel", o, !0),
            e.$watch("$ctrl.minLength", t),
            e.$watch("$ctrl.maxLength", t)
        }]
    }),
    e.component("formSearchDropdown", {
        template: '\n      <input type="hidden" name="{{ $ctrl.name }}" ng-required="$ctrl.required" ng-model="$ctrl.ngModel" />\n      <span class="form-search-dropdown-container" id="{{ $ctrl.id }}">\n        <span class="form-search-input-container form-search-input-show-{{ $ctrl.currentlyShowInput }}" ng-show="$ctrl.currentlyShowInput">\n          <icon-search class="form-search-input-icon"></icon-search>\n          <input class="form-search-input" type="text" ng-model="$ctrl.searchText" placeholder="{{ $ctrl.placeholder }}" form="_noform" />\n        </span>\n        <span class="form-search-options-container form-search-options-show-{{ $ctrl.showOptions }}" ng-show="$ctrl.currentlyShowOptions" tab-index="-1">\n          <span class="form-search-options-wrapper" ng-show="$ctrl.isLoading !== true">\n            <span class="form-search-options-item-container" ng-repeat="option in $ctrl.filteredOptions track by $index" tabindex="-1">\n              <span class="form-search-options-item" ng-class="{ \'form-search-options-item-active\': $index === $ctrl.currentIndex }" ng-if="option.value" ng-click="$ctrl.itemOnClick(option, $index)" ng-mouseenter="$ctrl.itemOnMouseenter(option, $index)">\n                <span class="form-search-options-item-text" ng-bind="option.text"></span>\n                <span class="form-search-options-item-remark" ng-bind="option.remark" ng-if="option.remark"></span>\n              </span>\n            </span>\n          </span>\n          <span class="form-search-options-empty" ng-show="$ctrl.isLoading !== true && $ctrl.filteredOptions.length === 0" ng-bind="$ctrl.emptyText || \'\'"></span>\n          <span class="form-search-options-loading" ng-show="$ctrl.isLoading === true" ng-bind="$ctrl.loadingText || \'\'"></span>\n        </span>\n      </span>\n    ',
        bindings: {
            name: "@",
            ngModel: "=?",
            searchText: "=?",
            options: "<",
            isLoading: "<?",
            emptyText: "@",
            loadingText: "@",
            placeholder: "@",
            showInput: "@",
            showOptions: "@",
            onSearch: "&",
            onSubmit: "&",
            onChange: "&",
            required: "@",
            filteOption: "@",
            submitOnBlur: "<?",
            clearOnSubmit: "<?",
            blurOnSubmit: "<?",
            parentActive: "=?"
        },
        controller: ["$scope", "$document", "$timeout",
        function(e, o, r) {
            var i = this,
            a = t(r, e),
            c = l(e);
            i.searchText = "",
            i.id = n();
            var s = function(e) {
                var n = angular.element(e.target),
                t = angular.element(document.getElementById(i.id));
                return t && t.find(n).length > 0
            },
            u = !1,
            d = function() {
                i.currentlyShowInput = {
                    always: !0,
                    never: !1
                } [i.showInput || "always"],
                i.currentlyShowOptions = {
                    always: !0,
                    never: !1,
                    active: u || i.parentActive
                } [i.showOptions || "active"]
            };
            d(),
            e.$watch("$ctrl.showInput", d),
            e.$watch("$ctrl.showOptions", d),
            i.currentIndex = -1,
            i.currentOption = null;
            var m = function(e, n) {
                i.currentOption = e,
                i.currentIndex = n
            },
            p = function(e) {
                return !! i.currentOption && e === i.currentOption.text
            },
            g = function() {
                i.currentOption = null,
                i.currentIndex = -1
            };
            i.chosedOption = null,
            i.ngModel = null;
            var f = function(e) {
                if (null === e) return h();
                i.chosedOption = e;
                var n = i.ngModel;
                i.ngModel = e.value,
                i.searchText = e.text,
                m(e, -1),
                a(function() {
                    n !== e && i.onChange({
                        option: e
                    }),
                    i.onSubmit({
                        option: e
                    }),
                    i.clearOnSubmit && h()
                },
                0)
            },
            h = function() {
                i.chosedOption = null,
                i.ngModel = null,
                i.searchText = "",
                a(function() {
                    return i.onChange({
                        option: null
                    })
                },
                0),
                g()
            },
            v = function() {
                u = !0,
                O(),
                d()
            },
            $ = function() {
                i.submitOnBlur ? (p(i.searchText) || L(), p(i.searchText) ? f(i.currentOption) : "" === i.searchText ? h() : f(i.chosedOption)) : f(i.chosedOption),
                u = !1,
                d()
            },
            b = function() {
                a(function() {
                    document.body.focus(),
                    $()
                },
                0)
            },
            y = function(e) {
                var n = s(e);
                n !== u && (n ? v() : $(), a(function() {}))
            };
            o.on("click focus focusin", y),
            c(function() {
                return o.off("click focus focusin", y)
            }),
            i.itemOnClick = function(e, n) {
                f(e),
                i.blurOnSubmit && b()
            },
            i.itemOnMouseenter = function(e, n) {
                m(e, n)
            };
            var x = function(e) {
                var n = i.filteredOptions;
                n && n.length && (e >= n.length && (e = 0), e < 0 && (e = n.length - 1), m(n[e], e))
            },
            w = function() {
                x(i.currentIndex + 1)
            },
            T = function() {
                x(i.currentIndex - 1)
            },
            M = function() {
                i.currentOption && f(i.currentOption)
            },
            E = function(e) {
                if (u || i.parentActive) {
                    var n = {
                        40 : w,
                        38 : T,
                        13 : function() {
                            M(),
                            i.blurOnSubmit && b()
                        },
                        27 : b
                    } [e.keyCode];
                    n && (n(), e.preventDefault(), e.stopPropagation(), a(function() {
                        a(k, 0),
                        a(k, 250)
                    }))
                }
            };
            o.on("keydown", E),
            c(function() {
                return o.on("keydown", E)
            });
            var L = function() {
                var e = i.filteredOptions || [],
                n = i.searchText;
                if (!p(n)) {
                    var t = -1;
                    e.some(function(e, o) {
                        return e.text === n && (t = o, !0)
                    }),
                    t !== -1 ? m(e[t], t) : g()
                }
            },
            C = function() {
                var e = i.searchText,
                n = i.searchDelay ? Number(i.searchDelay) : 200; (!n && 0 !== n || n < 0) && (n = 200),
                null !== e && a(function() {
                    i.searchText === e && i.onSearch({
                        text: i.searchText
                    })
                },
                n)
            },
            O = function() {
                C();
                var e = i.options || [];
                if (i.filteOption) {
                    var n = "start" === i.filteOption ?
                    function(e) {
                        return 0 === e
                    }: function(e) {
                        return e !== -1
                    };
                    e = e.filter(function(e) {
                        return n((e.text || "").indexOf(i.searchText))
                    })
                }
                angular.equals(e, i.filteredOptions) || (i.filteredOptions = angular.copy(e)),
                L()
            };
            e.$watch("$ctrl.searchText", O),
            e.$watch("$ctrl.options", O);
            var k = function() {
                var e = angular.element(document.getElementById(i.id)),
                n = angular.element(".form-search-options-wrapper", e),
                t = angular.element(".form-search-options-item-active", n).parent();
                if (t && t[0]) {
                    var o = t[0].offsetTop,
                    l = o + t.height(),
                    r = n.scrollTop(),
                    a = r + n.height(),
                    c = null;
                    o < r ? c = o: l > a && (c = l - n.height()),
                    null !== c && n.stop(!0, !0).animate({
                        scrollTop: c
                    },
                    200)
                } else n.stop(!0, !0).scrollTop(0)
            },
            S = function(e, n) {
                var t = i.options,
                o = null;
                null == i.ngModel && (null !== i.ngModel && (i.ngModel = null), i.chosedOption && (i.onChange({
                    option: null
                }), h())),
                i.ngModel === i.chosedOption ? o = i.chosedOption: t.some(function(e) {
                    return e.value === i.ngModel && (o = e, !0)
                }),
                o ? (i.searchText = o.text, i.onChange({
                    option: o
                }), i.onSubmit({
                    option: o
                }), i.clearOnSubmit && h()) : (i.chosedOption ? i.ngModel = i.chosedOption.value: i.ngModel = null, i.onChange({
                    option: i.chosedOption
                }), i.chosedOption && (i.onSubmit({
                    option: i.chosedOption
                }), i.clearOnSubmit && h()))
            };
            e.$watch("$ctrl.ngModel", S)
        }]
    }),
    e.component("formSelect", {
        template: '\n      <span id="{{ $ctrl.id }}" class="form-select-container">\n        <input type="hidden" name="{{ $ctrl.name }}" ng-required="$ctrl.required" ng-model="$ctrl.ngModel" />\n        <span class="form-select-wrapper">\n          <span class="form-select-fake-input" tabindex="0">\n            <span class="form-select-fake-input-value" ng-show="$ctrl.ngModel" ng-bind="$ctrl.text"></span>\n            <span class="form-select-fake-input-placeholder" ng-show="!$ctrl.ngModel" ng-bind="$ctrl.placeholder"></span>\n            <icon-drop-down class="form-select-down-icon"></icon-drop-down>\n          </span>\n        </span>\n        <form-search-dropdown\n          class="form-select-dropdown"\n          ng-model="$ctrl.value"\n          ng-class="{ \'form-select-dropdown-with-search\': $ctrl.showSearchInput !== \'never\' }"\n          ng-show="$ctrl.active"\n          options="$ctrl.options"\n          on-submit="$ctrl.onValueChange(option)"\n          empty-text="{{ $ctrl.emptyText || \'\' }}"\n          show-input="{{ $ctrl.showSearchInput || \'always\' }}"\n          show-options="always"\n          filte-option="{{ $ctrl.showSearchInput !== \'never\' ? \'filte-option\' : \'\' }}"\n          clear-on-submit="true"\n          input-in-dropdown="input-in-dropdown"\n          parent-active="$ctrl.active"\n          blur-on-submit="true"\n          is-loading="$ctrl.isLoading"\n          loading-text="{{ $ctrl.loadingText || \'\' }}"\n        ></form-search-dropdown>\n      </span>\n    ',
        bindings: {
            name: "@",
            ngModel: "=",
            options: "<",
            placeholder: "@",
            onChange: "&",
            required: "@",
            emptyText: "@",
            showSearchInput: "@",
            isLoading: "<",
            loadingText: "@"
        },
        controller: ["$scope", "$timeout", "$document",
        function(e, o, r) {
            var i = this,
            a = t(o, e),
            c = l(e);
            i.active = !1,
            i.id = n(),
            i.ngModel = null,
            i.value = null;
            var s = function(e) {
                var n = angular.element(e.target),
                t = angular.element(document.getElementById(i.id));
                return t && t.find(n).length > 0
            },
            u = function(e) {
                i.active = s(e),
                a(function() {})
            };
            r.on("click focus focusin", u),
            c(function() {
                return r.on("click focus focusin", u)
            }),
            i.onValueChange = function(e) {
                e && (i.text = e.text, i.ngModel = e.value, a(function() {
                    return i.onChange({
                        option: e
                    })
                },
                0)),
                a(function() {
                    return i.active = !1
                },
                0)
            },
            e.$watch("$ctrl.ngModel",
            function() {
                i.value = i.ngModel
            })
        }]
    }),
    e.component("formSelectWithBackend", {
        template: '\n      <form-select\n        ng-model="$ctrl.value"\n        name="{{ $ctrl.name }}"\n        on-change="$ctrl.output()"\n        options="$ctrl.candidateList"\n        show-search-input="{{ $ctrl.showSearchInput || \'always\' }}"\n        placeholder="{{$ctrl.placeholder}}"\n        is-loading="$ctrl.isLoading"\n        loading-text="{{$ctrl.loadingText || \'正在加载…\'}}"\n        empty-text="{{$ctrl.emptyText || \'无匹配选项\'}}"\n        ng-required="$ctrl.required"\n      ></form-select>\n    ',
        bindings: {
            backend: "@",
            param: "<?",
            name: "@",
            ngModel: "=?",
            options: "=?",
            placeholder: "@",
            onChange: "&",
            required: "@",
            emptyText: "@",
            showSearchInput: "@",
            loadingText: "@"
        },
        controller: ["$scope", "api", "$timeout", "$filter",
        function(e, n, t, o) {
            var l = this;
            l.candidateList = [];
            var r = n.SimplePromise.resolve({}),
            i = function() {
                if (l.backend) {
                    l.isLoading = !0;
                    var e = l.param;
                    r = n.select[l.backend](e).then(function(n) {
                        return l.candidateList = n,
                        {
                            param: e,
                            result: n
                        }
                    }),
                    r.
                    catch(function(e) {
                        return console.error(e)
                    }).then(function() {
                        l.isLoading = !1,
                        l.input()
                    })
                }
            };
            l.input = function() {
                if (null == l.ngModel) return void(l.value = null);
                r.then(function() {
                    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
                    n = e.param,
                    t = e.result;
                    if (n && angular.equals(n, l.param) && t === l.candidateList) {
                        var r = null;
                        r = "object" === _typeof(l.ngModel) && l.ngModel ? t.find(function(e) {
                            return o("filter")([l.ngModel], e.match, !0).length
                        }) : t.find(function(e) {
                            return e.value === l.ngModel
                        }),
                        l.value = r ? r.value: null,
                        l.output()
                    }
                })
            },
            l.output = function() {
                if (!angular.equals(l.ngModel, l.value)) {
                    var e = l.ngModel = l.value;
                    t(function() {
                        l.onChange({
                            option: e
                        })
                    })
                }
            },
            e.$watch("$ctrl.param", i, !0),
            e.$watch("$ctrl.backend", i),
            e.$watch("$ctrl.ngModel", l.input)
        }]
    }),
    e.component("formMultipleSelect", {
        template: '\n      <span id="{{ $ctrl.id }}" class="form-select-container form-multiple-select-container">\n        <input type="hidden" name="{{ $ctrl.name }}" ng-required="$ctrl.required"\n          ng-model="$ctrl.validValue" maxlength="" />\n        <span class="form-select-wrapper">\n          <span class="form-select-fake-input">\n            <ul class="form-select-item-collection">\n              <li class="form-select-chosed-item" ng-repeat="item in $ctrl.chosed" ng-class="{ \'form-select-chosed-about-to-delete\': $index === $ctrl.aboutToDelete }">\n                <span class="form-select-chosed-item-text" ng-bind="item.text"></span>\n                <icon type="close" class="form-select-chosed-item-delete" ng-click="$ctrl.deleteChosedItem(item)">\n              </li>\n              <li class="form-select-input-item">\n                <span class="form-select-input-text" ng-bind="$ctrl.searchText || $ctrl.placeholder" || \'\'></span>\n                <input type="text" class="form-select-input" placeholder="{{ $ctrl.placeholder }}" ng-model="$ctrl.searchText" ng-trim="false" form="_noform" />\n              </li>\n            </ul>\n          </span>\n        </span>\n        <form-search-dropdown\n          class="form-select-dropdown"\n          ng-model="$ctrl.value"\n          ng-show="$ctrl.active"\n          search-text="$ctrl.searchText"\n          options="$ctrl.options"\n          on-submit="$ctrl.onValueChange(option)"\n          empty-text="{{ $ctrl.emptyText || \'\' }}"\n          show-input="never"\n          show-options="always"\n          filte-option="filte-option"\n          clear-on-submit="true"\n          parent-active="$ctrl.active"\n          is-loading="$ctrl.isLoading || false"\n          loading-text="{{ $ctrl.loadingText || \'\' }}"\n        ></form-search-dropdown>\n      </span>\n    ',
        bindings: {
            name: "@",
            ngModel: "=",
            options: "<",
            placeholder: "@",
            onChange: "&",
            emptyText: "@",
            minLength: "@",
            maxLength: "@",
            isLoading: "<?",
            loadingText: "@",
            required: "@"
        },
        controller: ["$scope", "$timeout", "$document",
        function(e, o, r) {
            var i = this,
            a = t(o, e),
            c = l(e);
            i.active = !1,
            i.id = n(),
            i.ngModel = null,
            i.value = null,
            i.searchText = "",
            i.chosed = [],
            i.validValue = null;
            var s = function(e) {
                var n = angular.element(e.target),
                t = angular.element(document.getElementById(i.id));
                return t && t.find(n).length > 0
            },
            u = function() {
                var e = angular.element(document.getElementById(i.id)),
                n = angular.element(".form-select-input", e)[0];
                n && n !== document.activeElement && n.focus()
            },
            d = function(e) {
                i.active = s(e),
                i.active && u(),
                a(function() {})
            };
            r.on("click focus focusin", d),
            c(function() {
                return r.off("click focus focusin", d)
            }),
            i.onValueChange = function(e) {
                angular.isArray(i.chosed) || (i.chosed = []);
                var n = i.chosed,
                t = null;
                n.some(function(n, o) {
                    return !! angular.equals(n, e) && (t = o, !0)
                }),
                t !== n.length - 1 && (null !== t && i.chosed.splice(t, 1), i.chosed.push(e)),
                a(u, 0),
                x()
            },
            i.deleteChosedItem = function(e) {
                var n = i.chosed.indexOf(e);
                i.chosed.splice(n, 1),
                a(u, 0),
                x()
            },
            i.aboutToDelete = null;
            var m = function() {
                return null !== i.aboutToDelete
            },
            p = function() {
                var e = !0;
                return i.chosed && i.chosed.length || (e = !1),
                null === i.aboutToDelete && (e = !1),
                (i.aboutToDelete < 0 || i.aboutToDelete >= i.chosed.length) && (e = !1),
                e && i.deleteChosedItem(i.chosed[i.aboutToDelete]),
                i.aboutToDelete = null,
                e
            },
            g = function() {
                p() || (i.aboutToDelete = i.chosed.length - 1)
            },
            f = function(e) {
                var n = i.aboutToDelete;
                null === n && (n = i.chosed.length),
                n += e,
                n >= i.chosed.length && (i.aboutToDelete = null),
                i.aboutToDelete = n
            },
            h = function(e) {
                i.aboutToDelete = null
            },
            v = function(e) {
                if ("keydown" !== e.type) return ! 1;
                var n = angular.element(document.getElementById(i.id)),
                t = angular.element(".form-select-input", n)[0];
                return e.target === t
            },
            $ = function() {
                var e = angular.element(document.getElementById(i.id)),
                n = angular.element(".form-select-input", e)[0];
                if (document.activeElement !== n) return ! 1;
                var t = null;
                if ("selectionStart" in n) t = n.selectionStart;
                else if (document.selection) {
                    var o = document.selection.createRange(),
                    l = document.selection.createRange().text.length;
                    o.moveStart("character", -n.value.length),
                    t = o.text.length - l
                }
                return 0 === t
            },
            b = function() {
                return "" === i.searchText
            },
            y = function(e) {
                var n = !1;
                if (v(e)) {
                    if (8 === e.keyCode && (m() ? (n = !0, p()) : $() && (n = !0, g())), 37 === e.keyCode || 39 === e.keyCode) {
                        var t = 39 === e.keyCode ? 1 : -1; (b() || m()) && (n = !0, f(t))
                    }
                    46 === e.keyCode && m() && (n = !0, p())
                }
                n ? e.preventDefault() : m && (n = !0, h()),
                n && a(function() {})
            };
            r.on("click focusin focusout keydown", y),
            c(function() {
                r.off("click focusin focusout keydown", y)
            });
            var x = function() {
                var e = i.chosed.map(function(e) {
                    return e.value
                });
                angular.equals(e, i.ngModel) || (i.ngModel = e, a(function() {
                    return i.onChange()
                },
                0))
            },
            w = function() {
                angular.isArray(i.ngModel) || (i.ngModel = []),
                angular.isArray(i.options) || (i.options = []),
                angular.isArray(i.chosed) || (i.chosed = []);
                var e = i.options.concat(i.chosed);
                i.chosed = i.ngModel.map(function(n) {
                    return e.filter(function(e) {
                        return e.value === n
                    })[0] || null
                }).filter(function(e) {
                    return e
                }),
                x(),
                i.validValue = i.ngModel.join("; ")
            };
            e.$watch("$ctrl.ngModel", w, !0)
        }]
    }),
    e.component("formTable", {
        template: '\n      <table class="form-table">\n        <colgroup ng-if="$ctrl.columns.length">\n          <col class="form-table-column" ng-repeat="column in $ctrl.columns track by $index" ng-style="{ width: column.width || \'auto\' }"></col>\n        </colgroup>\n        <colgroup ng-if="$ctrl.hasButtons()">\n          <col class="form-table-column form-table-action-column" ng-style="{ width: 20 + 30 * $ctrl.buttonCount() }"></col>\n        </colgroup>\n        <thead>\n          <tr class="form-table-first-row">\n            <th class="form-table-column-title" ng-repeat="column in $ctrl.columns track by $index" ng-bind="column.text""></th>\n            <th class="form-table-column-title form-table-action-column-title" ng-if="$ctrl.hasButtons()">操作</th>\n          </tr>\n        </thead>\n        <tbody>\n          <tr ng-repeat="(rowIndex, row) in (($ctrl.ngModel || []) | filter:$ctrl.filterRule()) track by $index" class="form-table-row" ng-class="{ \'form-table-row-edit\': $ctrl.getEditStatus(rowIndex), \'form-table-last-row\': $ctrl.ngModel.length - 1 === rowIndex }">\n            <td ng-repeat="(columnIndex, column) in $ctrl.columns track by $index" class="form-table-ceil">\n              <div ng-repeat="edit in [$ctrl.getEditStatus(rowIndex)] track by $index">\n                <div ng-repeat="value in [row[column.key]] track by $index">\n                  <div ng-repeat="param in [$ctrl.param] track by $index">\n                    <div ng-include="$ctrl.template"></div>\n                  </div>\n                </div>\n              </div>\n            </td>\n            <td ng-if="$ctrl.hasButtons()" class="form-table-ceil form-table-action-ceil">\n              <div ng-if="!$ctrl.getEditStatus(rowIndex)">\n                <icon-group>\n                  <icon-by-name ng-repeat="action in $ctrl.customButtons" name="{{ action.icon }}" ng-click="$ctrl.customButton(action, rowIndex)" tooltip="{{ action.text }}"></icon-by-name>\n                  <icon-edit tooltip="编辑" ng-click="$ctrl.mayEdit(rowIndex) && $ctrl.beforeEdit(rowIndex)" ng-if="$ctrl.hasEdit()" disabled="{{ $ctrl.mayEdit(rowIndex) ? \'\' : \'disabled\' }}"></icon-edit>\n                  <icon-delete tooltip="删除" ng-click="$ctrl.mayDelete(rowIndex) && $ctrl.deleteItem(rowIndex)" ng-if="$ctrl.hasDelete()" disabled="{{ $ctrl.mayDelete(rowIndex) ? \'\' : \'disabled\' }}"></icon-delete>\n                </icon-group>\n              </div>\n              <div ng-if="$ctrl.getEditStatus(rowIndex)">\n                <icon-group>\n                  <icon-save tooltip="保存" ng-click="$ctrl.saveItem(rowIndex)"></icon-save>\n                  <icon-cancel tooltip="取消" ng-click="$ctrl.cancelEdit(rowIndex)"></icon-cancel>\n                </icon-group>\n              </div>\n            </td>\n          </tr>\n          <tr ng-if="$ctrl.emptyText && (($ctrl.ngModel || []) | filter:$ctrl.filterRule()).length === 0" class="form-table-row form-table-row-empty">\n            <td class="form-table-empty-text" colspan="{{ $ctrl.columns.length + $ctrl.hasButtons() }}" ng-bind="$ctrl.emptyText"></td>\n          </tr>\n        </tbody>\n      </table>\n    ',
        bindings: {
            columns: "<",
            onDelete: "&?",
            onSave: "&?",
            onBeforeEdit: "&?",
            onCancelEdit: "&?",
            disabled: "@",
            noDelete: "<?",
            noEdit: "<?",
            template: "@",
            ngModel: "=",
            onCustomButton: "&?",
            customButtons: "<?",
            compareKey: "@",
            emptyText: "@",
            filter: "<?",
            editedData: "=?",
            param: "<?"
        },
        controller: [function() {
            var e = this;
            e.hasEdit = function() {
                return !! (e.onBeforeEdit || e.onCancelEdit || e.onSave)
            },
            e.hasDelete = function() {
                return !! e.onDelete
            },
            e.hasButtons = function() {
                return ! (e.disabled || !(e.hasEdit() || e.hasDelete() || e.onCustomButton || e.customButtons))
            },
            e.buttonCount = function() {
                return e.hasEdit() + e.hasDelete() + (e.customButtons || []).length
            },
            e.getEditStatus = function(n) {
                return !! (e.hasButtons() && !e.ngModel[n].disabled && n in e.editedData)
            };
            var n = function(n, t) {
                return e.compareKey ? angular.equals(n[e.compareKey], t[e.compareKey]) : angular.equals(n, t)
            };
            e.mayEdit = function(t) {
                return (e.noEdit || []).every(function(o) {
                    return ! n(o, e.ngModel[t])
                })
            },
            e.mayDelete = function(t) {
                return (e.noDelete || []).every(function(o) {
                    return ! n(o, e.ngModel[t])
                })
            },
            e.editedData = {},
            e.beforeEdit = function(n) {
                e.onBeforeEdit && e.onBeforeEdit({
                    data: e.ngModel[n],
                    index: n
                }),
                e.editedData[n] = angular.copy(e.ngModel[n])
            },
            e.saveItem = function(n) {
                e.onSave && e.onSave({
                    data: e.ngModel[n],
                    index: n
                }),
                delete e.editedData[n]
            },
            e.deleteItem = function(n) {
                e.onDelete && e.onDelete({
                    data: e.ngModel[n],
                    index: n
                }),
                e.ngModel.splice(n, 1);
                for (var t = n; t < e.ngModel.length; t++) t + 1 in e.editedData && (e.editedData[t] = e.editedData[t + 1], delete e.editedData[t + 1])
            },
            e.cancelEdit = function(n) {
                e.onCancelEdit && e.onCancelEdit({
                    data: e.ngModel[n],
                    index: n
                }),
                angular.copy(e.editedData[n], e.ngModel[n]),
                delete e.editedData[n]
            },
            e.customButton = function(n, t) {
                e.onCustomButton && e.onCustomButton({
                    action: n,
                    index: t,
                    data: e.ngModel[t]
                })
            },
            e.filterRule = function() {
                return e.filter || {}
            }
        }]
    }),
    e.component("inputWithCopy", {
        template: '\n      <div class="input-with-button" id="{{ $ctrl.id }}">\n        <div class="input-with-button-input">\n          <input ng-if="$ctrl.appearance !== \'textarea\' && $ctrl.appearance !== \'codearea\'" type="text" ng-model="$ctrl.ngModel" ng-readonly="$ctrl.readonly" />\n          <textarea ng-if="$ctrl.appearance === \'textarea\'" ng-model="$ctrl.ngModel" ng-readonly="$ctrl.readonly"></textarea>\n          <codearea ng-if="$ctrl.appearance === \'codearea\'" ng-model="$ctrl.ngModel" readonly="{{ $ctrl.readonly ? \'readonly\' : \'\' }}" language="$ctrl.language"></codearea>\n        </div>\n        <div class="input-with-button-button">\n          <button type="button" class="input-with-button-copy" data-clipboard-target="#{{ $ctrl.id }} input, #{{ $ctrl.id }} textarea"><icon-clipboard></icon-clipboard></button>\n        </div>\n      </div>\n    ',
        bindings: {
            ngModel: "=",
            appearance: "@?",
            language: "@",
            readonly: "@"
        },
        controller: ["api",
        function(e) {
            var t = this;
            t.id = n(),
            e.loadScript("/lib/js/clipboard.js/clipboard.min.js",
            function() {
                return window.Clipboard
            }).then(function() {
                var e = "#" + t.id + " button";
                new Clipboard(e).on("success",
                function(e) {
                    e.clearSelection()
                })
            })
        }]
    }),
    e.component("codearea", {
        template: '\n      <div id="{{ $ctrl.id }}" class="codearea-container">\n        <textarea class="codearea-hidden-textarea" style="display: none;" name="$ctrl.name" ng-model="$ctrl.ngModel" ng-required="$ctrl.required"></textarea>\n        <div id="{{ $ctrl.editorId }}" class="codearea-ace-container"></div>\n      </div>\n    ',
        bindings: {
            language: "@",
            ngModel: "=",
            required: "@",
            name: "@?",
            readonly: "@",
            height: "@",
            onChange: "&"
        },
        controller: ["api", "$scope", "$interval", "$timeout",
        function(e, t, l, r) {
            var i = this,
            a = o(l, t),
            c = o(r, t);
            i.id = n(),
            i.editorId = n(),
            i.name || (i.name = n());
            var s = {
                dockerfile: "dockerfile",
                json: "json",
                markdown: "markdown",
                shell: "sh",
                xml: "xml",
                yaml: "yaml"
            },
            u = null,
            d = null,
            m = 0,
            p = 0;
            e.loadScript("/lib/js/ace/ace.js",
            function() {
                return window.ace
            }).then(function() {
                u = ace.edit(i.editorId),
                u.getSession().setMode("ace/mode/" + (s[i.language] || "text")),
                u.on("input",
                function() {
                    i.ngModel = d = u.getValue(),
                    c(function() {
                        i.onChange()
                    })
                }),
                u.setValue(d || "", 1),
                u.setOptions({
                    fontSize: "14px"
                }),
                u.$blockScrolling = 1 / 0,
                u.setReadOnly( !! i.readonly),
                u.setOptions({
                    minLines: m,
                    maxLines: p
                })
            });
            var g = null;
            a(function() {
                var e = document.getElementById(i.editorId);
                e && g !== e.clientHeight && (g = e.clientHeight, u && u.resize())
            },
            100),
            t.$watch("$ctrl.ngModel",
            function(e, n) {
                d !== e && (d = e, u && u.setValue(d, 1))
            }),
            t.$watch("$ctrl.readonly",
            function(e, n) {
                u && u.setReadOnly( !! i.readonly)
            }),
            t.$watch("$ctrl.language",
            function(e, n) {
                u && u.getSession().setMode("ace/mode/" + (s[i.language] || "text"))
            }),
            t.$watch("$ctrl.height",
            function(e, n) {
                var t = ((i.height || "") + "").match(/^(?=(\d+))(?=(?:\d+\s*,\s*)?(\d*)$)(?:\d+(?:\s*,\s*\d*)?)$/);
                t ? (m = parseInt(t[1], 0) || 0, p = "" === t[2] ? 1 / 0 : parseInt(t[2], 0) || 0) : m = p = 0,
                u && u.setOptions({
                    minLines: m,
                    maxLines: p
                })
            })
        }]
    }),
    e.component("markdown", {
        template: '\n      <div class="markdown-container markdown" ng-bind-html="$ctrl.html"></div>\n    ',
        bindings: {
            source: "@?",
            src: "@?",
            emptyText: "@?"
        },
        controller: ["$scope", "api",
        function(e, n) {
            var t = this;
            t.html = "";
            var o = 0,
            l = function() {
                t.html = "";
                var e = ++o,
                l = null;
                l = t.source ? n.SimplePromise.resolve(t.source) : t.src ? n.network(t.src, "GET", {
                    responseType: "arraybuffer"
                }).then(function(e) {
                    return decodeURIComponent(escape(String.fromCharCode.apply(String, new Uint8Array(e)))).trim()
                }) : n.SimplePromise.resolve(""),
                l = l.
                catch(function(e) {
                    return ""
                }).then(function(e) {
                    return e || t.emptyText || ""
                });
                var r = n.loadScript("/lib/js/showdown.min.js",
                function() {
                    return window.showdown
                },
                function() {
                    showdown.setOption("strikethrough", "true"),
                    showdown.setOption("tables", "true"),
                    showdown.setOption("tasklists", "true"),
                    showdown.setOption("simplifiedAutoLink", "true")
                });
                n.SimplePromise.all([l, r]).then(function(n) {
                    var l = _slicedToArray(n, 1),
                    r = l[0];
                    if (e === o) {
                        var i = new showdown.Converter,
                        a = i.makeHtml(r),
                        c = angular.element("<div></div>").html(a);
                        angular.element("a, area", c).attr("target", "_blank"),
                        t.html = c.html()
                    }
                })
            };
            e.$watchGroup(["$ctrl.source", "$ctrl.src"],
            function() {
                l()
            })
        }]
    }),
    e.component("eventList", {
        template: '\n      <div class="event-list-container">\n        <span class="event-list-empty" ng-bind="$ctrl.emptyText" ng-if="!$ctrl.value || !$ctrl.value.length"></span>\n        <ol class="event-list" ng-if="$ctrl.value && $ctrl.value.length">\n          <li class="event-list-item" ng-repeat="row in $ctrl.value">\n            <span class="event-list-content event-list-icon event-list-icon-{{ $ctrl.eventType || ($ctrl.eventTypeAttr ? row[$ctrl.eventTypeAttr] : row.type) || \'info\' }}">\n            </span>\n            <span class="event-list-content" ng-repeat="column in $ctrl.column track by $index">\n              <span ng-repeat="value in [row[column]] track by $index">\n                <span ng-include="$ctrl.template"></span>\n              </span>\n            </span>\n          </li>\n        </ol>\n      </div>\n    ',
        bindings: {
            value: "<",
            column: "<",
            template: "@",
            param: "<?",
            eventType: "@?",
            eventTypeAttr: "@?",
            emptyText: "@"
        },
        controller: [function() {}]
    }),
    e.component("chartContainer", {
        template: '\n      <div class="chart chart-container" id="$ctrl.id">\n        <div class="chart-title">{{ $ctrl.chartTitle }}</div>\n        <div class="chart-content chart-content-legend-{{ $ctrl.legendPosition }}">\n          <div class="chart-img" ng-style="{ visibility: $ctrl.noData === true ? \'hidden\' : \'visible\' }">\n            <div class="chart-img-wrap" style="padding: 20px 10px {{ $ctrl.chartHeight + 0 === $ctrl.chartHeight * 1 ? ($ctrl.chartHeight + \'px\') : $ctrl.chartHeight }}">\n              <div class="chart-img-container" ng-transclude></div>\n            </div>\n          </div>\n          <div class="chart-legend-container" ng-style="{ visibility: $ctrl.noData === true ? \'hidden\' : \'visible\' }">\n            <ul class="chart-legend">\n              <li class="chart-legend-item" ng-repeat="label in $ctrl.groups"\n                ng-mouseenter="$ctrl.onLegendMouseenter({ legend: label })"\n                ng-mouseleave="$ctrl.onLegendMouseleave({ legend: label })"\n                ng-click="$ctrl.onLegendClick({ legend: label })"\n              >\n                <span class="chart-legend-item-sample" style="background-color: {{ $ctrl.color[$index] }}"></span>\n                <span>{{ label }}</span>\n              </li>\n            </ul>\n          </div>\n          <div class="chart-no-data" ng-bind="$ctrl.emptyText" ng-if="$ctrl.noData"></div>\n        </div>\n      </div>\n    ',
        transclude: !0,
        bindings: {
            chartHeight: "@?",
            chartTitle: "@",
            noData: "<?",
            legendPosition: "@",
            groups: "<",
            color: "<",
            emptyText: "@",
            onLegendMouseenter: "&",
            onLegendMouseleave: "&",
            onLegendClick: "&"
        },
        controller: [function() {
            this.id = n()
        }]
    }),
    e.component("chart", {
        template: '\n      <chart-container\n        chart-title="{{ $ctrl.chartTitle }}"\n        groups="$ctrl.groups"\n        color="$ctrl.color"\n        legend-position="{{ $ctrl.legendPosition }}"\n        empty-text="{{ $ctrl.emptyText }}"\n        no-data="$ctrl.noData"\n        class="chartjs chart chart-{{ $ctrl.type }}"\n        id="{{ $ctrl.id }}"\n        chart-height="{{ $ctrl.type === \'line\' ? \'50%\' : \'100%\' }}"\n      >\n          <canvas></canvas>\n      </chart-container>\n    ',
        bindings: {
            chartTitle: "@",
            data: "<",
            groups: "<?",
            items: "<?",
            color: "<",
            type: "@",
            legendPosition: "@",
            options: "<?",
            emptyText: "@"
        },
        controller: ["api", "$scope",
        function(e, t) {
            var o = this;
            o.id = n();
            var l = e.loadScript("/lib/js/Chart.min.js",
            function() {
                return window.Chart
            }),
            r = null,
            i = function() {
                if (r) try {
                    r.clear().destroy()
                } catch(e) {}
            };
            t.$on("$destory", i);
            var a = function() {
                i();
                var e = angular.element("canvas", document.getElementById(o.id)),
                n = void 0,
                t = void 0,
                a = {};
                if (o.noData = !1, "pie" === o.type) Array.isArray(o.data) && o.data.indexOf(null) === -1 && 0 !== o.data.reduce(function(e, n) {
                    return e + n
                },
                0) || (o.noData = !0),
                n = [{
                    data: o.data,
                    label: o.groups,
                    backgroundColor: o.color,
                    hoverBackgroundColor: o.color,
                    pointBorderColor: o.color,
                    pointHoverBorderColor: o.color,
                    pointBackgroundColor: o.color,
                    pointHoverBackgroundColor: o.color
                }],
                t = o.groups,
                a = {
                    tooltips: {
                        callbacks: {
                            label: function(e, n) {
                                return n.labels[e.index]
                            }
                        }
                    }
                };
                else if ("line" === o.type) {
                    Array.isArray(o.data) && o.data.length || (o.noData = !0),
                    n = (o.data || []).map(function(e, n) {
                        return Array.isArray(e) && o.data.indexOf(null) === -1 || (o.noData = !0),
                        {
                            data: e,
                            label: o.groups[n],
                            borderColor: o.color[n],
                            backgroundColor: o.color[n],
                            hoverBackgroundColor: o.color[n],
                            fill: !1
                        }
                    }),
                    t = o.items;
                    var c = Math.max.apply(Math, o.data.map(function(e) {
                        return Math.max.apply(Math, e)
                    }));
                    a = {
                        scales: {
                            yAxes: [{
                                ticks: {
                                    stepSize: Math.max(1, Math.ceil(c / 5)),
                                    beginAtZero: !0
                                }
                            }]
                        }
                    }
                }
                var s = angular.copy({
                    type: o.type,
                    data: {
                        labels: t,
                        datasets: n
                    },
                    options: Object.assign({
                        legend: {
                            display: !1
                        },
                        responsive: !0,
                        layout: {
                            padding: 20
                        }
                    },
                    a, o.options || {})
                });
                l.then(function() {
                    setTimeout(function() {
                        return r = new Chart(e, s)
                    },
                    100)
                })
            };
            t.$watchGroup(["$ctrl.data", "$ctrl.labels", "$ctrl.color", "$ctrl.type"],
            function() {
                a()
            })
        }]
    }),
    e.component("lineChart", {
        template: '\n      <chart-container\n        chart-title="{{ $ctrl.chartTitle }}"\n        groups="$ctrl.groups"\n        color="$ctrl.color"\n        legend-position="{{ $ctrl.legendPosition }}"\n        empty-text="{{ $ctrl.emptyText }}"\n        no-data="!$ctrl.data"\n        on-legend-mouseenter="$ctrl.onLegendMouseenter({ legend: legend })"\n        on-legend-mouseleave="$ctrl.onLegendMouseleave({ legend: legend })"\n        on-legend-click="$ctrl.onLegendClick({ legend: legend })"\n        class="dygraph chart chart-line"\n        id="{{ $ctrl.id }}"\n        chart-height="{{ $ctrl.chartHeight || \'100%\' }}"\n      >\n        <div class="dygraph-chart-container"></div>\n      </chart-container>\n    ',
        bindings: {
            chartTitle: "@",
            groups: "<",
            color: "<",
            emptyText: "@",
            chartHeight: "@",
            legendPosition: "@",
            onLegendMouseenter: "&",
            onLegendMouseleave: "&",
            onLegendClick: "&",
            data: "<?"
        },
        controller: ["$scope", "$timeout", "chartHandler",
        function(e, t, o) {
            var l = this;
            l.id = n();
            var r = null,
            i = null;
            t(function() {
                var n = document.getElementById(l.id),
                t = n.getElementsByClassName("dygraph-chart-container")[0];
                r = new Dygraph(t, l.data || [], {
                    labels: ["x"].concat(_toConsumableArray(l.groups)),
                    connectSeparatedPoints: !0,
                    drawPoints: !0,
                    interactionModel: {},
                    colors: l.color,
                    plotter: smoothPlotter
                }),
                i || (i = {
                    getDygraph: function() {
                        return r
                    },
                    updateOptions: function() {
                        var e;
                        return (e = r).updateOptions.apply(e, arguments)
                    },
                    updateData: function(e) {
                        l.data = e,
                        r.updateOptions({
                            file: e
                        })
                    }
                },
                o.set(n, i), e.$on("$destory",
                function() {
                    o.del(n)
                }))
            })
        }]
    }),
    e.service("chartHandler", ["$timeout", "api",
    function(e, n) {
        var t = [],
        o = [],
        l = function(e, n) {
            return e === n || e.firstElementChild === n
        },
        r = function(e) {
            o = o.filter(function(e) {
                var n = e.matcher,
                o = e.resolve,
                r = t.filter(function(e) {
                    var t = e.content;
                    return l(n, t)
                })[0] || {},
                i = r.chart;
                return ! i || (o(i), !1)
            })
        };
        this.get = function(t) {
            return new n.SimplePromise(function(n) {
                "string" == typeof t ? e(function() {
                    t = document.getElementById(t),
                    t && o.push({
                        matcher: t,
                        resolve: n
                    }),
                    r()
                }) : o.push({
                    matcher: t,
                    resolve: n
                }),
                r()
            })
        },
        this.set = function(e, n) {
            t.push({
                content: e,
                chart: n
            }),
            r()
        },
        this.del = function(e) {
            this.set(e, null),
            t = t.filter(function(e) {
                var n = e.c;
                return c !== n
            })
        }
    }]),
    e.component("multipleUserSelect", {
        template: '\n      <form-multiple-select\n        options="$ctrl.userListFiltered"\n        ng-model="$ctrl.ngModel"\n        placeholder="{{ $ctrl.placeholder || \'\' }}"\n        is-loading="$ctrl.isLoading"\n        loading-text="正在获取用户列表"\n      ></form-multiple-select>\n    ',
        bindings: {
            notInList: "<?",
            ngModel: "=",
            placeholder: "@"
        },
        controller: ["$scope", "api",
        function(e, n) {
            var t = this;
            t.allUsers = [],
            t.userListFiltered = [],
            t.isLoading = !0;
            var o = function() {
                t.isLoading || (t.userListFiltered = t.allUsers.filter(function(e) {
                    return (t.notInList || []).indexOf(e.id) === -1
                }))
            };
            n.user.list().then(function(e) {
                t.allUsers = e.map(function(e) {
                    return {
                        value: e,
                        text: e.name,
                        id: e.id
                    }
                }),
                t.isLoading = !1,
                o()
            }).
            catch(function(e) {
                return angular.noop()
            }),
            e.$watch("$ctrl.notInList",
            function() {
                o()
            },
            !0)
        }]
    }),
    e.component("memberCollectionSelect", {
        template: '\n      <form-select\n        options="$ctrl.options"\n        ng-model="$ctrl.ngModel"\n        placeholder="{{ $ctrl.placeholder || \'\' }}"\n        is-loading="$ctrl.loadingTypes[$ctrl.type] !== false"\n        loading-text="正在加载列表"\n        empty-text="无相关用户组信息"\n      ></form-select>\n    ',
        bindings: {
            type: "@",
            ngModel: "=",
            placeholder: "@",
            notInList: "<?"
        },
        controller: ["$scope", "api",
        function(e, n) {
            var t = this,
            o = [],
            l = {};
            t.loadingTypes = {},
            t.options = [];
            var r = function() {
                l[t.type] && (t.options = l[t.type].map(function(e) {
                    return {
                        value: e,
                        text: e.name
                    }
                }).filter(function(e) {
                    return (t.notInList || []).every(function(n) {
                        return n.id !== e.value.id || n.type !== e.value.type
                    })
                }))
            },
            i = function() {
                if (o.indexOf(t.type) !== -1 && !t.loadingTypes[t.type]) if (l[t.type]) r();
                else {
                    var e = t.type;
                    t.loadingTypes[e] = !0,
                    t.options = [],
                    t.ngModel = null,
                    n.memberCollection.listByType(e).then(function(n) {
                        t.loadingTypes[e] = !1,
                        l[e] = n,
                        r()
                    })
                }
            };
            n.memberCollection.getTypes().then(function(e) {
                o = e,
                i()
            }),
            e.$watch("$ctrl.type", i),
            e.$watch("$ctrl.notInList", i)
        }]
    }),
    e.component("collectionMemberTable", {
        template: '\n      <div class="collection-member-table-container">\n        <form-multiple-inline content-type="search">\n          <form-multiple-inline-item class="collection-member-edit-button-container">\n            <form-button-collection>\n              <form-input-checkbox value="\'MEMBER\'" value-false="null" ng-model="$ctrl.addingTypeOne" on-change="$ctrl.addingType = $ctrl.addingTypeOne; $ctrl.addingTypeMulti = null; $ctrl.addingShown = true;" ng-init="$ctrl.addingTypeOne = null" appearance="button">逐个添加成员</form-input-checkbox>\n              <form-input-checkbox value="\'GROUP\'" value-false="null" ng-model="$ctrl.addingTypeMulti" on-change="$ctrl.addingType = $ctrl.addingTypeMulti; $ctrl.addingTypeOne = null; $ctrl.addingShown = true;" ng-init="$ctrl.addingTypeMulti = null" appearance="button">批量导入成员</form-input-checkbox>\n            </form-button-collection>\n          </form-multiple-inline-item>\n          <form-multiple-inline-item class="collection-member-count-container">\n            <span>\n              共\n              <span ng-show="$ctrl.searchText">\n                <span class="collection-member-count-filtered" ng-bind="(($ctrl.ngModel.length ? $ctrl.ngModel : []) | filter:{ name: $ctrl.searchText }).length"></span>\n                /\n              </span>\n              <span>\n                <span class="collection-member-count-total" ng-bind="$ctrl.ngModel.length"></span>\n              </span>\n              位成员\n            </span>\n          </form-multiple-inline-item>\n          <form-multiple-inline-item class="collection-member-search-container">\n            <form-search-box ng-init="$ctrl.searchText = \'\'" ng-model="$ctrl.searchText" placeholder="搜索项目成员"></form-search-box>\n          </form-multiple-inline-item>\n        </form-multiple-inline>\n        <form-help-line ng-if="$ctrl.helpText">\n          <icon-info></icon-info> <span ng-bind="$ctrl.helpText"></span>\n        </form-help-line>\n        <div class="collection-member-adding-panel" ng-show="$ctrl.addingType" ng-if="$ctrl.addingShown">\n          <form-multiple-inline algin="left">\n            <form-multiple-inline-item class="collection-member-group-type-selector-container" ng-show="$ctrl.addingType === \'GROUP\'">\n              <script id="collectionMemberTypeTemplate" type="text/ng-template">\n                <span ng-bind="option.text"></span>\n              </script>\n              <form-select\n                class="collection-member-type-radio"\n                options="[\n                  { value: \'PROJECT_COLLECTION\', text: \'导入项目成员\' },\n                  { value: \'DEPLOY_COLLECTION\', text: \'导入服务成员\' },\n                  { value: \'CLUSTER\', text: \'导入集群成员\' },\n                  { value: \'CONFIGURATION_COLLECTION\', text: \'导入配置管理成员\' },\n                  { value: \'LOADBALANCER_COLLECTION\', text: \'导入负载均衡成员\' },\n                ]"\n                ng-model="$ctrl.groupType"\n                ng-init="$ctrl.groupType = \'PROJECT_COLLECTION\'"\n                show-search-input="never"\n                card-template="collectionMemberTypeTemplate"\n              ></form-input-radio-group>\n            </form-multiple-inline-item>\n            <form-multiple-inline-item class="collection-member-users-selector-container">\n              <multiple-user-select\n                ng-show="$ctrl.addingType === \'MEMBER\'"\n                ng-model="$ctrl.chosedMemberList"\n                placeholder="选择用户以添加"\n              ></multiple-user-select>\n              <member-collection-select\n                ng-show="$ctrl.addingType === \'GROUP\'"\n                type="{{ $ctrl.groupType }}"\n                ng-model="$ctrl.chosedGroup"\n                placeholder="选择{{ ({\n                  PROJECT_COLLECTION : \'项目\',\n                  DEPLOY_COLLECTION : \'服务\',\n                  CLUSTER : \'集群\',\n                  STORAGE_CLUSTER : \'存储\',\n                  CONFIGURATION_COLLECTION : \'配置管理\',\n                  LOADBALANCER_COLLECTION : \'负载均衡\'\n                })[$ctrl.groupType] }}以导入"\n                not-in-list="[{ type: $ctrl.collectionType, id: $ctrl.collectionId }]"\n              ></member-collection-select>\n            </form-multiple-inline-item>\n            <form-multiple-inline-item class="collection-member-role-selector-container">\n              <form-select\n                ng-show="$ctrl.addingType === \'MEMBER\'"\n                options="[\n                  { value: \'MASTER\', text: \'MASTER\' },\n                  { value: \'DEVELOPER\', text: \'DEVELOPER\' },\n                  { value: \'REPORTER\', text: \'REPORTER\' },\n                ]"\n                ng-init="$ctrl.addingMemberRole = \'MASTER\'"\n                show-search-input="never"\n                ng-model="$ctrl.addingMemberRole"\n              ></form-select>\n              <form-select\n                ng-show="$ctrl.addingType !== \'MEMBER\'"\n                options="[\n                  { value: \'MASTER\', text: \'MASTER\' },\n                  { value: \'DEVELOPER\', text: \'DEVELOPER\' },\n                  { value: \'REPORTER\', text: \'REPORTER\' },\n                  { value: \'DEFAULT\', text: \'保留组内权限设置\' },\n                ]"\n                ng-init="$ctrl.addingGroupRole = \'DEFAULT\'"\n                show-search-input="never"\n                ng-model="$ctrl.addingGroupRole"\n              ></form-select>\n            </form-multiple-inline-item>\n            <form-multiple-inline-item class="collection-member-add-button-container">\n              <button class="collection-member-new-button" type="button" ng-click="$ctrl.addMember()" ng-bind="$ctrl.addingType === \'MEMBER\' ? \'添加\' : \'导入\'"></button>\n            </form-multiple-inline-item>\n          </form-multiple-inline>\n        </div>\n        <script id="collectionMemberTableTemplate" type="text/ng-template">\n          <div ng-if="edit && column.key === \'role\'">\n            <form-select\n              ng-model="row.role"\n              options="[\n                {value: \'MASTER\', text: \'MASTER\'},\n                {value: \'DEVELOPER\', text: \'DEVELOPER\'},\n                {value: \'REPORTER\', text: \'REPORTER\'}\n              ]"\n              show-search-input="never"\n            ></form-select>\n          </div>\n          <div ng-if="!edit || column.key !== \'role\'">\n            <div ng-bind="value"></div>\n          </div>\n        </script>\n        <form-table\n          class="collection-member-table"\n          ng-model="$ctrl.value"\n          columns="[{text: \'成员\', key: \'name\'}, {text: \'组内角色\', key: \'role\'}]"\n          template="collectionMemberTableTemplate"\n          filter="{ name: $ctrl.searchText }"\n          empty-text="{{ $ctrl.loading ? \'正在获取成员列表，请稍候\' : ($ctrl.searchText ? \'无匹配成员信息\' : \'无成员信息\') }}"\n          edited-data="$ctrl.editedData"\n          on-save="$ctrl.updateUserRole(data)"\n          on-delete="$ctrl.removeUser(data)"\n          no-edit="$ctrl.noEdit"\n          no-delete="$ctrl.noDelete"\n        ></form-table>\n        <div class="collection-member-loading-cover" ng-show="$ctrl.loading">\n        </div>\n      </div>\n    ',
        bindings: {
            ngModel: "=?",
            collectionType: "<?",
            collectionId: "<?",
            onNoPermission: "&?",
            onRoleChange: "&",
            helpText: "@"
        },
        controller: ["$scope", "api", "dialog",
        function(e, n, t) {
            var o = this;
            o.loading = !1,
            o.userRole = null;
            var l = function() {
                return t.
                continue.apply(t, arguments).then(function(e) {
                    if (e !== t.button.BUTTON_OK) throw ""
                })
            },
            r = ["MASTER", "DEVELOPER", "REPORTER", "GUEST"],
            i = function(e) {
                return r.indexOf(e) + 1 || r.length
            },
            a = function(e) {
                var t = null;
                return t = e ? "您将要把自己的权限降低为" + e + "，修改后您可能无法继续编辑成员信息或执行部分管理操作，确认要继续吗？": "您将要把自己从成员列表中删除，删除后您将不能继续访问相关资源，确认要继续吗？",
                n.SimplePromise.resolve(l("您的权限即将发生变化", t))
            },
            c = function(e) {
                return n.SimplePromise.resolve(l("确认删除成员", "您将要把" + e + "从成员列表中删除，确认要继续吗？"))
            };
            o.addMember = function() {
                if (o.currentCollection) {
                    var e = void 0;
                    if ("MEMBER" === o.addingType) {
                        if (!o.chosedMemberList || !o.chosedMemberList.length) return;
                        var l = o.chosedMemberList.map(function(e) {
                            return {
                                id: e.id,
                                role: o.addingMemberRole
                            }
                        });
                        e = n.SimplePromise.resolve(l)
                    } else {
                        if (!o.chosedGroup) return;
                        e = n.memberCollection.get(o.chosedGroup),
                        "DEFAULT" !== o.addingGroupRole && (e = e.then(function(e) {
                            return e.forEach(function(e) {
                                e.role = o.addingGroupRole
                            }),
                            e
                        }))
                    }
                    o.loading = !0,
                    e.then(function(e) {
                        return n.memberCollection.add(o.currentCollection, e)
                    }).then(function() {
                        o.chosedMemberList = [],
                        o.chosedGroup = void 0
                    },
                    function(e) {
                        t.error("操作失败", e.message || "添加用户时发生错误")
                    }).
                    catch(function(e) {
                        t.error("操作失败", e.message || "获取组成员时发生错误")
                    }).then(function() {
                        return u()
                    }).then(function() {
                        o.loading = !1
                    })
                }
            },
            o.updateUserRole = function(e) {
                o.loading = !0;
                var l = null;
                l = e.id === o.myInfo.id && i(e.role) > i(o.userRole) && !o.myInfo.isAdmin ? a(e.role) : n.SimplePromise.resolve(),
                l.then(function() {
                    return n.memberCollection.modify(o.currentCollection, e)
                },
                function() {}).
                catch(function(e) {
                    t.error("操作失败", e.message || "修改权限时放生错误")
                }).then(function() {
                    return u()
                }).then(function() {
                    o.loading = !1
                })
            },
            o.removeUser = function(e) {
                o.loading = !0;
                var l = null;
                l = e.id !== o.myInfo.id || o.myInfo.isAdmin ? c(e.name) : a(),
                l.then(function() {
                    return n.memberCollection.delete(o.currentCollection, e)
                },
                function() {}).
                catch(function(e) {
                    t.error("操作失败", e.message || "删除用户时发生错误")
                }).then(function() {
                    return u()
                }).then(function() {
                    o.loading = !1
                })
            },
            o.ngModel = [],
            o.value = [],
            o.noEdit = [],
            o.noDelete = [],
            o.editedData = {};
            var s = function(e, n, t) {
                o.ngModel = e,
                o.noEdit = [],
                o.noDelete = [],
                "MASTER" !== t && (o.noEdit = e.slice(0), o.noDelete = e.filter(function(e) {
                    return e.id !== n.id
                }));
                var l = e.filter(function(e) {
                    return "MASTER" === e.role
                });
                1 === l.length && (o.noEdit.push(l[0]), o.noDelete.push(l[0]));
                var r = {},
                i = {},
                a = angular.copy(e);
                Object.keys(o.editedData).forEach(function(e) {
                    var n = o.editedData[e];
                    r[n.id] = n,
                    i[n.id] = o.value[e]
                });
                var c = {};
                e.forEach(function(e, n) {
                    r[e.id] && (c[n] = e, a[n] = i[e.id])
                }),
                o.value = a,
                o.editedData = c
            };
            o.currentCollection = null;
            var u = function(e) {
                null == e && (e = o.currentCollection);
                var l = n.memberCollection.myRole(e),
                r = n.user.whoami(),
                i = n.memberCollection.get(e);
                return l.then(function(e) {
                    o.userRole = e,
                    o.onRoleChange({
                        role: e
                    })
                }),
                r.then(function(e) {
                    o.myInfo = e
                }),
                n.SimplePromise.all([i, r, l]).then(function(n) {
                    var t = _slicedToArray(n, 3),
                    l = t[0],
                    r = t[1],
                    i = t[2];
                    e.id === o.collectionId && e.type === o.collectionType && (o.currentCollection = e, s(l, r, i))
                }).
                catch(function(e) {
                    return l.then(function(n) {
                        if ("GUEST" !== n || !o.onNoPermission) throw e;
                        o.onNoPermission()
                    }).
                    catch(function(e) {
                        t.error("操作失败", e.message || "获取成员信息时发生错误")
                    })
                })
            },
            d = function(e) {
                return m(),
                u(e)
            },
            m = function() {
                return o.ngModel = void 0,
                o.currentCollection = null,
                o.role = null,
                o.editedData = {},
                n.SimplePromise.resolve()
            },
            p = function() {
                var e = void 0;
                o.collectionType && o.collectionId || (e = null),
                e = {
                    type: o.collectionType,
                    id: o.collectionId
                };
                var n = void 0;
                n = e ? d(e) : m(),
                o.loading = !0,
                n.then(function() {
                    return o.loading = !1
                })
            };
            e.$watchGroup(["$ctrl.collectionType", "$ctrl.collectionId"], p)
        }]
    }),
    e.component("formSelectorImage", {
        template: '\n      <div class="com-select-con add-mirror" select-con>\n        <input class="ui-input-white ui-btn-select input-image"\n          placeholder="{{ $ctrl.placeholder }}" ng-model="imageKey" />\n        <ul class="select-list">\n          <li class="select-item" ng-repeat="image in $ctrl.imageList | filter: { \'imageName\': imageKey }">\n            <a ng-click="$ctrl.choseImage(image)"><span ng-bind="image.imageName"></span><span class="txt-prompt pull-right" ng-bind="image.registry"></span></a>\n          </li>\n        </ul>\n      </div>\n    ',
        bindings: {
            onImageSelected: "&",
            imageList: "<",
            placeholder: "<"
        },
        controller: [function() {
            var e = this;
            e.choseImage = function(n) {
                e.onImageSelected({
                    image: n
                })
            }
        }]
    }),
    e.component("formSelectorProjectImage", {
        template: '\n      <form-selector-image\n        on-image-selected="$ctrl.subOnImageSelected(image)"\n        image-list="$ctrl.imageList"\n        placeholder="$ctrl.placeholder"\n      ></form-selector-image>\n    ',
        bindings: {
            onImageSelected: "&"
        },
        controller: ["$http",
        function(e) {
            var n = this;
            n.placeholder = "选择镜像",
            n.imageList = [],
            e.get("/api/image").then(function(e) {
                var t = e.data.result || [];
                Array.prototype.push.apply(n.imageList, t)
            }),
            n.subOnImageSelected = function(e) {
                n.onImageSelected({
                    image: e
                })
            }
        }]
    }),
    e.component("addMultipleMember", {
        template: '\n        <div class="collection-member-adding-panel">\n            <form-multiple-inline algin="left">\n                <form-multiple-inline-item class="collection-member-users-selector-container">\n                    <multiple-user-select ng-model="$ctrl.addingUserList" placeholder="选择成员"></multiple-user-select>\n                </form-multiple-inline-item>\n                <form-multiple-inline-item class="collection-member-role-selector-container">\n                    <form-select ng-init="$ctrl.addingUserRole = \'MASTER\'" ng-model="$ctrl.addingUserRole" options="[{ value: \'MASTER\', text: \'MASTER\' }, { value: \'DEVELOPER\', text: \'DEVELOPER\'}, {value: \'REPORTER\', text: \'REPORTER\'}]" show-search-input="never")></form-select>\n                </form-multiple-inline-item>\n                <form-multiple-inline-item class="collection-member-add-button-container">\n                    <button class="collection-member-new-button" type="button" ng-click="$ctrl.addUser()">添加</button>\n                </form-multiple-inline-item>\n            </form-multiple-inline>\n        </div>\n        <form-table \n            ng-model="$ctrl.chosenUserList" \n            template="chosenUserTable" \n            columns="[\n                {text: \'成员名称\', key: \'name\', width: \'50%\'},\n                {text: \'角色权限\', key: \'role\', width: \'35%\'}\n            ]"\n            on-delete \n            no-delete="$ctrl.noDelete" \n            compare-key="id"\n            param="{myself: $ctrl.myself}"\n        ></form-table>\n        <script type="text/ng-template" id="chosenUserTable">\n            <div ng-if="column.key === \'name\'" ng-bind="value"></div>\n            <div ng-if="param.myself.id !== row.id && column.key === \'role\'">\n                <form-select\n                    ng-model="row.role"\n                    options="[\n                        {value: \'MASTER\', text: \'MASTER\'},\n                        {value: \'DEVELOPER\', text: \'DEVELOPER\'},\n                        {value: \'REPORTER\', text: \'REPORTER\'}\n                      ]"\n                    show-search-input="never"\n                ></form-select>\n            </div>\n            <div ng-if="param.myself.id == row.id && column.key === \'role\'" ng-bind="value"></div>\n        </script>',
        bindings: {
            chosenUserList: "=?"
        },
        controller: ["api",
        function(e) {
            var n = this;
            n.chosenUserList = [],
            n.noDelete = [],
            e.user.whoami().then(function(e) {
                var t = e;
                n.myself = {
                    id: t.id,
                    name: t.name,
                    role: "MASTER"
                },
                n.noDelete.push(n.myself),
                n.chosenUserList.push({
                    id: t.id,
                    name: t.name,
                    role: "MASTER"
                })
            }),
            n.addUser = function() {
                n.addingUserList.map(function(e) {
                    n.chosenUserList.every(function(n) {
                        return n.id !== e.id
                    }) && n.chosenUserList.push({
                        id: e.id,
                        name: e.name,
                        role: n.addingUserRole
                    })
                }),
                n.addingUserList = []
            }
        }]
    }),
    e.component("clusterSelector", {
        template: '\n      <form-select \n        ng-model="$ctrl.ngModel" \n        name="$ctrl.name" \n        options="$ctrl.clusterSelectorList" \n        placeholder="请选择集群" \n        on-change="$ctrl.toggleCluster()" \n        show-search-input="never" \n        ng-required="$ctrl.required"\n        is-loading="$ctrl.isLoadingCluster" \n        loading-text="正在获取集群" \n        empty-text="无相关集群信息">\n      </form-select>\n      ',
        bindings: {
            name: "@",
            ngModel: "=?",
            onChange: "&",
            required: "@"
        },
        controller: ["$scope", "api", "$timeout",
        function(e, n, o) {
            var l = this;
            l.isLoadingCluster = !0,
            n.cluster.listCluster().then(function(e) {
                var n = e || [];
                l.clusterSelectorList = n.map(function(e) {
                    return {
                        text: e.name,
                        value: e
                    }
                }),
                n.length > 0 && (l.ngModel ? l.ngModel = n.forEach(function(e) {
                    if (e.id === l.ngModel.id) return e
                }) : l.ngModel = n[0])
            }).
            catch(function(e) {
                console.log("clusterSelector list exception: ", e)
            }).then(function() {
                l.isLoadingCluster = !1
            });
            var r = t(o, e);
            l.toggleCluster = function() {
                r(function() {
                    l.onChange()
                })
            }
        }]
    }),
    e.component("namespaceSelector", {
        template: '\n      <form-with-button width="150px">\n          <content-area>\n            <form-select ng-if="$ctrl.isDisplayExistentNamespace()" ng-model="$ctrl.value.namespace" name="{{ $ctrl.name + \'selector\' }}" on-change="$ctrl.toggleNamespace()" options="$ctrl.namespaceSelectorList" placeholder="请选择namespace" required="true" is-loading="isLoadingNamespace" loading-text="正在获取namespace" empty-text="无相关信息"></form-select>\n            <input ng-if="!$ctrl.isDisplayExistentNamespace()" ng-model="$ctrl.value.namespace" type="text" name="{{ $ctrl.name + \'input\' }}" placeholder="新建namespace" required is-namespace-Unique ng-pattern="/^[a-zA-Z][a-zA-Z0-9_-]*$/" clusterid="{{$ctrl.cluster.id}}" ng-model-options="{updateOn:\'default blur\',debounce:{default:500,blur:0}}" />\n            <form-error-message form="$ctrl.formName" target="{{ $ctrl.name + \'selector\' }}" type="required">namespace不能为空，请新建或者更改集群</form-error-message>\n            <form-error-message form="$ctrl.formName" target="{{ $ctrl.name + \'input\' }}" type="required">namespace不能为空</form-error-message>\n            <form-error-message form="$ctrl.formName" target="{{ $ctrl.name + \'input\' }}" type="isNamespaceUnique"> namespace已存在，请修改后重试！</form-error-message>\n            <form-error-message form="$ctrl.formName" target="{{ $ctrl.name + \'input\' }}" type="pattern"> namespace格式错误，请修改后重试！</form-error-message>\n          </content-area>\n        <button-area>\n            <button type="button" ng-click="$ctrl.toggleNamespaceFillInType()"> {{ $ctrl.namespaceFillInType[$ctrl.value.isExistentNamespace] }} </button>\n        </button-area>\n      </form-with-button>\n      ',
        bindings: {
            name: "@",
            ngModel: "=?",
            onChange: "&",
            cluster: "<?",
            formName: "<?"
        },
        controller: ["$scope", "api", "$timeout",
        function(e, n, o) {
            var l = this;
            l.value = {
                isExistentNamespace: !0,
                namespace: null
            },
            l.namespaceFillInType = {
                true: "新建namespace",
                false: "选择已有namespace"
            },
            l.isLoadingNamespace = !0;
            var r = function() {
                l.cluster && l.cluster.id && n.cluster.getNamespace(l.cluster.id).then(function(e) {
                    var n = e || [];
                    l.namespaceSelectorList = [],
                    n.forEach(function(e) {
                        "default" === e.name && (l.value.namespace = e.name),
                        l.namespaceSelectorList.push({
                            text: e.name,
                            value: e.name
                        })
                    }),
                    n.length > 0 && null == l.value.namespace ? l.value.namespace = n[0].name: 0 === n.length && l.value.isExistentNamespace && (l.value.namespace = null),
                    l.isLoadingNamespace = !1
                }).
                catch(function(e) {
                    l.isLoadingNamespace = !1,
                    console.log("exception: ", e)
                })
            },
            i = t(o, e);
            l.toggleNamespace = function() {
                i(function() {
                    l.onChange()
                })
            },
            l.isDisplayExistentNamespace = function() {
                return l.value.isExistentNamespace
            };
            var a = "";
            l.toggleNamespaceFillInType = function() {
                l.value.isExistentNamespace ? (a = l.ngModel.namespace, l.value.namespace = null) : l.value.namespace = a,
                l.value.isExistentNamespace = !l.value.isExistentNamespace
            },
            e.$watch("$ctrl.cluster", r),
            e.$watch("$ctrl.value",
            function() {
                l.ngModel = l.value
            })
        }]
    }),
    e.component("formMultipleSelectList", {
        template: '\n        <form-multiple-select name="{{ $ctrl.name || \'\'}}" ng-model="$ctrl.value" on-change="$ctrl.output()" \n        options="$ctrl.candidateList" placeholder="{{$ctrl.placeholder || \'\' }}" is-loading="$ctrl.isLoading" loading-text=" {{ $ctrl.loadingText || \'\' }}" empty-text="{{ $ctrl.emptyText || \'\' }}" required="true">\n        </form-multiple-select>\n        <form-error-message form="$ctrl.formName" target="{{ $ctrl.name || \'\'}}" type="required">{{$ctrl.errorMessage || \'\'}}</form-error-message>\n      ',
        bindings: {
            ngModel: "=?",
            parameters: "<?",
            formName: "<?",
            placeholder: "@",
            loadingText: "@",
            emptyText: "@",
            errorMessage: "@",
            name: "@",
            getListFn: "@"
        },
        controller: ["$scope", "api", "$filter",
        function(e, n, t) {
            var o = this;
            o.candidateList = [];
            var l = n.SimplePromise.resolve({}),
            r = function() {
                Object.keys(o.parameters).filter(function(e) {
                    return void 0 === o.parameters[e]
                }).length || o.getListFn && (o.isLoading = !0, l = n.listItem[o.getListFn](o.parameters).then(function(e) {
                    return o.candidateList = e,
                    {
                        parameters: o.parameters,
                        result: e
                    }
                }), l.
                catch(function() {}).then(function() {
                    o.isLoading = !1,
                    o.input()
                }))
            };
            o.input = function() {
                angular.isArray(o.ngModel) && 0 !== (o.ngModel || []).length && l.then(function(e) {
                    if (angular.equals(e.parameters, o.parameters)) {
                        var n = [];
                        o.ngModel.forEach(function(o) {
                            e.result.forEach(function(e) {
                                angular.isObject(o) ? t("filter")([o], e.match, !0).length && n.push(e.value) : o === e.match && n.push(e.value)
                            })
                        }),
                        o.value = n,
                        o.output()
                    }
                })
            },
            o.output = function() {
                angular.equals(o.ngModel, o.value) || (o.ngModel = o.value)
            },
            e.$watch("$ctrl.parameters", r, !0),
            e.$watch("$ctrl.getListFn", r),
            e.$watch("$ctrl.ngModel", o.input)
        }]
    }),
    e.component("formSelectList", {
        template: '\n      <form-select ng-model="$ctrl.value" name="{{ $ctrl.name }}" on-change="$ctrl.toggle()" options="$ctrl.candidateList" show-search-input="always" placeholder="{{$ctrl.placeholder}}" is-loading="$ctrl.isLoading" loading-text="{{$ctrl.loadingText}}" empty-text="{{$ctrl.emptyText}}" required="true"></form-select>\n      <form-error-message form="$ctrl.formName" target="{{ $ctrl.name }}" type="required">{{$ctrl.errorMessage}}</form-error-message>\n    ',
        bindings: {
            name: "@",
            ngModel: "=?",
            formName: "<?",
            fallbackOptions: "<?",
            parameters: "<?",
            onChange: "&",
            loadingText: "@",
            emptyText: "@",
            placeholder: "@",
            errorMessage: "@",
            getListFn: "@"
        },
        controller: ["$scope", "api", "$timeout", "$filter",
        function(e, n, t, o) {
            var l = this;
            l.candidateList = [];
            var r = n.SimplePromise.resolve({}),
            i = function() {
                Object.keys(l.parameters).filter(function(e) {
                    return void 0 === l.parameters[e]
                }).length || Object.keys(l.parameters).filter(function(e) {
                    return null === l.parameters[e]
                }).length || l.getListFn && (l.isLoading = !0, r = n.listItem[l.getListFn](l.parameters).then(function(e) {
                    return l.fallbackOptions && l.fallbackOptions.text && l.fallbackOptions.value && (e.some(function(e) {
                        return e.text === l.fallbackOptions.text
                    }) || e.push(l.fallbackOptions)),
                    l.candidateList = e,
                    {
                        parameters: l.parameters,
                        result: e
                    }
                }), r.
                catch(function() {}).then(function() {
                    l.isLoading = !1,
                    l.input()
                }))
            };
            l.input = function() {
                l.ngModel && r.then(function(e) {
                    angular.equals(e.parameters, l.parameters) && (e.result.some(function(e) {
                        return !! o("filter")([l.ngModel], e.match, !0).length && (l.value = e.value, !0)
                    }) || (l.value = null), l.output())
                })
            },
            l.output = function() {
                angular.equals(l.ngModel, l.value) || (l.ngModel = l.value)
            },
            l.toggle = function() {
                l.output(),
                t(function() {
                    l.onChange()
                })
            },
            e.$watch("$ctrl.parameters", i, !0),
            e.$watch("$ctrl.getListFn", i),
            e.$watch("$ctrl.ngModel", l.input)
        }]
    })
} (window.formInputs = window.formInputs || angular.module("formInputs", ["backendApi", "domeModule", "ngSanitize"]));